Implement the resizeEvent to make the statistics always visible.

Always fit the whole scene in the view.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-08-25 16:31:05 -03:00 committed by Dirk Hohndel
parent 1c56c9f626
commit b01ef9a0a5
2 changed files with 8 additions and 0 deletions

View file

@ -34,3 +34,9 @@ void YearlyStatisticsWidget::modelDataChanged(const QModelIndex &topLeft, const
{
// stub
}
void YearlyStatisticsWidget::resizeEvent(QResizeEvent *event)
{
QGraphicsView::resizeEvent(event);
fitInView(sceneRect(), Qt::IgnoreAspectRatio);
}

View file

@ -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);