From b01ef9a0a5da0467aa7630ec1e903331ba4a2d33 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 25 Aug 2014 16:31:05 -0300 Subject: Implement the resizeEvent to make the statistics always visible. Always fit the whole scene in the view. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/statistics/statisticswidget.cpp | 6 ++++++ qt-ui/statistics/statisticswidget.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/qt-ui/statistics/statisticswidget.cpp b/qt-ui/statistics/statisticswidget.cpp index 8ac8d1cdb..89555eb23 100644 --- a/qt-ui/statistics/statisticswidget.cpp +++ b/qt-ui/statistics/statisticswidget.cpp @@ -34,3 +34,9 @@ void YearlyStatisticsWidget::modelDataChanged(const QModelIndex &topLeft, const { // stub } + +void YearlyStatisticsWidget::resizeEvent(QResizeEvent *event) +{ + QGraphicsView::resizeEvent(event); + fitInView(sceneRect(), Qt::IgnoreAspectRatio); +} diff --git a/qt-ui/statistics/statisticswidget.h b/qt-ui/statistics/statisticswidget.h index 0042ce67c..4e62a10fd 100644 --- a/qt-ui/statistics/statisticswidget.h +++ b/qt-ui/statistics/statisticswidget.h @@ -11,6 +11,8 @@ class YearlyStatisticsWidget : public QGraphicsView { public: YearlyStatisticsWidget(QWidget *parent = 0); void setModel(YearlyStatisticsModel *m); +protected: + virtual void resizeEvent(QResizeEvent *event); public slots: void modelRowsInserted(const QModelIndex& index, int first, int last); void modelRowsRemoved(const QModelIndex& index, int first, int last); -- cgit v1.2.3-70-g09d2