From: Max Lapan Date: Tue, 16 Mar 2010 13:01:16 +0000 (+0300) Subject: Context menu. X-Git-Tag: v0.1~25 X-Git-Url: http://vcs.maemo.org/git/?p=yandex-traffic;a=commitdiff_plain;h=cd12f05dc1bb958043631587acd2ab74e3de0238 Context menu. --- diff --git a/mainwidget.cpp b/mainwidget.cpp index 5f4771c..8149f1f 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -155,3 +155,22 @@ void MainWidget::applySettings () else _timer->setInterval (1000 * 60 * _settings->updateInterval ()); } + + +void MainWidget::mousePressEvent (QMouseEvent *event) +{ + QMenu menu; + QAction *settingsAction, *updateAction, *todo; + + settingsAction = menu.addAction (tr ("Settings")); + updateAction = menu.addAction (tr ("Update")); + + todo = menu.exec (event->pos ()); + if (!todo) + return; + + if (todo == settingsAction) + settingsDialog (); + if (todo == updateAction) + _traffic->update (); +} diff --git a/mainwidget.hpp b/mainwidget.hpp index 9fb10cd..00df461 100644 --- a/mainwidget.hpp +++ b/mainwidget.hpp @@ -34,6 +34,7 @@ public slots: protected: void paintEvent (QPaintEvent *event); + void mousePressEvent (QMouseEvent *event); void updateSize (); void applySettings ();