# HG changeset patch # User unc0rr # Date 1231602482 0 # Node ID e528696f21779f8a808a36b085c1146fc4cca19d # Parent cc5976f292f9560a13c9dbed716b7652cfd3ee63 Resize health graphic when form is resized diff -r cc5976f292f9 -r e528696f2177 QTfrontend/statsPage.cpp --- a/QTfrontend/statsPage.cpp Sat Jan 10 15:45:15 2009 +0000 +++ b/QTfrontend/statsPage.cpp Sat Jan 10 15:48:02 2009 +0000 @@ -19,10 +19,19 @@ #include #include #include -#include #include "statsPage.h" +FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) +{ + +} + +void FitGraphicsView::resizeEvent(QResizeEvent * event) +{ + fitInView(sceneRect()); +} + PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) { QFont * font14 = new QFont("MS Shell Dlg", 14); @@ -37,7 +46,7 @@ labelGameStats->setTextFormat(Qt::RichText); pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); - graphic = new QGraphicsView(this); + graphic = new FitGraphicsView(this); graphic->scale(1.0, -1.0); pageLayout->addWidget(graphic, 1, 0, 1, 3); } @@ -76,7 +85,6 @@ } graphic->setScene(scene); - graphic->fitInView(graphic->sceneRect()); } void PageGameStats::GameStats(char type, const QString & info) diff -r cc5976f292f9 -r e528696f2177 QTfrontend/statsPage.h --- a/QTfrontend/statsPage.h Sat Jan 10 15:45:15 2009 +0000 +++ b/QTfrontend/statsPage.h Sat Jan 10 15:48:02 2009 +0000 @@ -21,9 +21,19 @@ #include #include +#include #include "pages.h" -class QGraphicsView; +class FitGraphicsView : public QGraphicsView +{ + Q_OBJECT + +public: + FitGraphicsView(QWidget* parent = 0); + +protected: + void resizeEvent(QResizeEvent * event); +}; class PageGameStats : public AbstractPage { @@ -34,7 +44,7 @@ QPushButton *BtnBack; QLabel *labelGameStats; - QGraphicsView * graphic; + FitGraphicsView * graphic; public slots: void GameStats(char type, const QString & info);