From a678a18b989a0e722ed4333eeff07b2c2494a3e9 Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Thu, 11 Mar 2010 19:09:49 +0300 Subject: [PATCH] Resolve issue with configuration button incorrectly placed. --- light.cpp | 2 +- mainwidget.cpp | 31 ++++++++++++++----------------- mainwidget.hpp | 1 - 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/light.cpp b/light.cpp index 20b5734..61613af 100644 --- a/light.cpp +++ b/light.cpp @@ -10,7 +10,7 @@ TrafficLight::TrafficLight (QWidget *parent) : QWidget (parent) { _color = ExtendedTrafficInfo::Unknown; - setMinimumSize (30, 30); + setFixedSize (40, 40); } diff --git a/mainwidget.cpp b/mainwidget.cpp index a9c1277..160a8c0 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -10,32 +10,28 @@ MainWidget::MainWidget () : QWidget () { + setMinimumSize (300, 80); #ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_TranslucentBackground); #endif - _light = new TrafficLight (this); - _label = new QLabel (this); + _light = new TrafficLight (this); + _label = new QLabel (this); - QHBoxLayout *layout = new QHBoxLayout; - layout->addWidget (_light); - layout->addWidget (_label); - setLayout (layout); + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget (_light); + layout->addWidget (_label); + setLayout (layout); - connect (&_traffic, SIGNAL (updated ()), SLOT (trafficUpdated ())); + connect (&_traffic, SIGNAL (updated ()), SLOT (trafficUpdated ())); - // every 5 minutes (TODO, make option) - startTimer (5*60*1000); + // every 5 minutes (TODO, make option) + startTimer (5*60*1000); - // perform update just after creation - _traffic.update (); + // perform update just after creation + _traffic.update (); } -QSize MainWidget::sizeHint() const -{ - return _label->sizeHint () + _light->sizeHint () + QSize (20, 0); -} - void MainWidget::paintEvent(QPaintEvent *event) { @@ -57,6 +53,7 @@ void MainWidget::timerEvent (QTimerEvent *) } + void MainWidget::trafficUpdated () { ExtendedTrafficInfo info = _traffic.lookup_ext ("1"); diff --git a/mainwidget.hpp b/mainwidget.hpp index 0fb63a2..59aa5f2 100644 --- a/mainwidget.hpp +++ b/mainwidget.hpp @@ -23,7 +23,6 @@ private: public: MainWidget (); - QSize sizeHint () const; protected: void paintEvent (QPaintEvent *event); -- 1.7.9.5