diff options
author | Stanislav Ionascu <stanislav.ionascu@nokia.com> | 2010-11-17 15:38:01 +0200 |
---|---|---|
committer | Armin Berres <armin.berres@basyskom.de> | 2010-11-18 14:09:29 +0100 |
commit | 4ea2ddbe6542c7cff998888f5c9b8ecfbb918911 (patch) | |
tree | 1cda6786a7e29986e642990774c89b5770a3c4bc /demos | |
parent | 4fdba0d6e44fd43b4c91cf9a54c578f6d1074e2f (diff) |
Changes: Delay toggle and click events of the switch button until the animation is finished.
RevBy: Peter Penz, Armin Berres
Details: Such as when a heavy task is executing then animation would be finished already and
provide the user some sort of feedback regarding if the state has been enabled or not.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/widgetsgallery/switchpage.cpp | 16 | ||||
-rw-r--r-- | demos/widgetsgallery/switchpage.h | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/demos/widgetsgallery/switchpage.cpp b/demos/widgetsgallery/switchpage.cpp index 188a2b53..a735da58 100644 --- a/demos/widgetsgallery/switchpage.cpp +++ b/demos/widgetsgallery/switchpage.cpp @@ -25,9 +25,7 @@ #include <MGridLayoutPolicy> #include <MLinearLayoutPolicy> #include <MButton> -#include <MButtonGroup> -#include <MDebug> -#include <MApplication> +#include <MMessageBox> #include <QGraphicsLinearLayout> SwitchPage::SwitchPage() : @@ -68,6 +66,7 @@ void SwitchPage::createContent() l->setAlignment(switch1, Qt::AlignCenter); //l->setAlignment(label1, Qt::AlignRight); containerPolicy->addItem(l); + connect(switch1, SIGNAL(toggled(bool)), this, SLOT(switchToggled(bool))); switch2 = new MButton(); switch2->setViewType(MButton::switchType); @@ -148,4 +147,15 @@ void SwitchPage::retranslateUi() label5->setText(qtTrId("xx_switch_page_switch5")); } +void SwitchPage::switchToggled(bool toggle) +{ + MMessageBox *msgBox = new MMessageBox(); + + if (toggle) + msgBox->setText("The feature was enabled"); + else + msgBox->setText("The feature was disabled"); + + msgBox->appear(MDialog::DestroyWhenDone); +} diff --git a/demos/widgetsgallery/switchpage.h b/demos/widgetsgallery/switchpage.h index 1d3f54e1..e39a2c6a 100644 --- a/demos/widgetsgallery/switchpage.h +++ b/demos/widgetsgallery/switchpage.h @@ -39,8 +39,13 @@ public: virtual ~SwitchPage(); virtual QString timedemoTitle(); virtual void createContent(); + protected: virtual void retranslateUi(); + +protected Q_SLOTS: + void switchToggled(bool toggle); + private: MButton *switch1; MButton *switch2; |