--- 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 <QLabel>
#include <QGridLayout>
#include <QGraphicsScene>
-#include <QGraphicsView>
#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)
--- 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 <QVector>
#include <QMap>
+#include <QGraphicsView>
#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);