From 1f6ecd9d10e9f81cbbea441353782391ac0b2550 2012-01-19 09:41:59 From: Tero Ahola Date: 2012-01-19 09:41:59 Subject: [PATCH] Added size hint for the widget --- diff --git a/src/qchartwidget.cpp b/src/qchartwidget.cpp index d3a146d..e6f6567 100644 --- a/src/qchartwidget.cpp +++ b/src/qchartwidget.cpp @@ -29,13 +29,13 @@ public: QChart* m_chart; }; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// QChartWidget::QChartWidget(QWidget *parent) : QWidget(parent), d_ptr(new QChartWidgetPrivate(this)) { - + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } QChartWidget::~QChartWidget() @@ -52,6 +52,11 @@ void QChartWidget::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); } +QSize QChartWidget::sizeHint() const +{ + // TODO: calculate size hint based on contents? + return QSize(100, 100); +} void QChartWidget::addSeries(QChartSeries* series) { diff --git a/src/qchartwidget.h b/src/qchartwidget.h index 8fa3858..1269f17 100644 --- a/src/qchartwidget.h +++ b/src/qchartwidget.h @@ -19,6 +19,7 @@ public: //implement from QWidget void resizeEvent(QResizeEvent *event); + QSize sizeHint() const; void addSeries(QChartSeries* series); protected: