aboutsummaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authordenes dezso <matusz@matusz.tietoenator.com>2010-10-25 09:22:46 +0300
committerHolger Schröder <holger.schroeder.ext@basyskom.de>2010-11-05 21:22:38 +0100
commit5c8a2a514393ebe8f082237395fe586ae2131d75 (patch)
tree828213357481706a56b1e9905c8445d5a47547f1 /demos
parent4f375477b887e1a3f1399428531a7e5e7196d69f (diff)
Fixes: NB#185046 - Progress bar doesn't work in Progress Bar widget until device orientation changed
Fixes: NB#190383 - <MemLeak> Valgrind leak in mpositionindicatorview.cpp Fixes: NB#190432 - Progress bar doesn't show any progress while taking backup. Fixes: NB#193447 - <UninitVar> mprogressindicatorbarview.cpp RevBy: Thomas Moenicke, Sergiy Dubovik, Dominik Kapusta Details: Refactoring MProgressIndicatorBarView and MProgressIndicatorBarViewPrivate classes
Diffstat (limited to 'demos')
-rw-r--r--demos/widgetsgallery/progressbarpage.cpp35
-rw-r--r--demos/widgetsgallery/progressbarpage.h6
2 files changed, 28 insertions, 13 deletions
diff --git a/demos/widgetsgallery/progressbarpage.cpp b/demos/widgetsgallery/progressbarpage.cpp
index c8f429ee..85d0e6fb 100644
--- a/demos/widgetsgallery/progressbarpage.cpp
+++ b/demos/widgetsgallery/progressbarpage.cpp
@@ -26,11 +26,13 @@
#include <MLinearLayoutPolicy>
#include <MGridLayoutPolicy>
#include <MProgressIndicator>
-#include <MSceneManager>
#include <QPropertyAnimation>
+#include <MSceneManager>
ProgressBarPage::ProgressBarPage() :
TemplatePage(TemplatePage::SimpleWidgets),
+ button1(0),
+ bar1ValueAnimation(0),
bar1(0),
bar2(0),
label1(0),
@@ -61,6 +63,14 @@ void ProgressBarPage::createContent()
bar1->setValue(0);
containerPolicy->addItem(bar1);
+ bar1ValueAnimation = new QPropertyAnimation(bar1, "value", this);
+ bar1ValueAnimation->setEasingCurve(QEasingCurve::OutInQuad);
+
+ button1 = new MButton();
+ button1->setIconID("icon-m-common-play");
+ containerPolicy->addItem(button1, Qt::AlignHCenter);
+ containerPolicy->setVerticalSpacing(10);
+
label2 = new MLabel();
containerPolicy->addItem(label2);
@@ -69,15 +79,7 @@ void ProgressBarPage::createContent()
bar2->setUnknownDuration(true);
containerPolicy->addItem(bar2);
- QPropertyAnimation* animation = new QPropertyAnimation(bar1, "value", this);
- // loop forever
- animation->setLoopCount(-1);
- // start and end value should match bar1's range
- animation->setStartValue(0);
- animation->setEndValue(1000);
- // 10 seconds to fill the bar
- animation->setDuration(10000);
- animation->start();
+ connect(button1, SIGNAL(clicked()), this, SLOT(animateProgressBar1()));
retranslateUi();
}
@@ -97,5 +99,14 @@ void ProgressBarPage::retranslateUi()
label2->setText(qtTrId("xx_progressindicator_unknown_duration_bar"));
}
-
-
+void ProgressBarPage::animateProgressBar1()
+{
+ if (bar1ValueAnimation->state() != QAbstractAnimation::Running) {
+ // start and end value should match bar1's range
+ bar1ValueAnimation->setStartValue(bar1->minimum());
+ bar1ValueAnimation->setEndValue(bar1->maximum());
+ // 10 seconds to fill the bar
+ bar1ValueAnimation->setDuration(10000);
+ bar1ValueAnimation->start();
+ }
+}
diff --git a/demos/widgetsgallery/progressbarpage.h b/demos/widgetsgallery/progressbarpage.h
index 223c8a84..91921115 100644
--- a/demos/widgetsgallery/progressbarpage.h
+++ b/demos/widgetsgallery/progressbarpage.h
@@ -22,11 +22,11 @@
#include "templatepage.h"
-
class MGridLayoutPolicy;
class MProgressIndicator;
class MButton;
class MLabel;
+class QPropertyAnimation;
class ProgressBarPage : public TemplatePage
{
@@ -39,11 +39,15 @@ public:
protected:
virtual void retranslateUi();
private:
+ MButton* button1;
+ QPropertyAnimation* bar1ValueAnimation;
MProgressIndicator *bar1;
MProgressIndicator *bar2;
MLabel *label1;
MLabel *label2;
int position;
+private Q_SLOTS:
+ void animateProgressBar1();
};
#endif // PROGRESSBARPAGE_H