diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-08-29 11:31:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-29 12:26:30 +0200 |
commit | 71e4e00c64b059814d2c41b46018fda645dd0a51 (patch) | |
tree | 54051f86a9c0db669c500f079d1a0fe95e2cf383 /src/winextras/qwintaskbarprogress.cpp | |
parent | 491b83d228a5eecaae3cbb8a63355d8cd2da6996 (diff) |
Replace QWinTaskbarProgress::NoProgressState with a visible-property
Calling show()/hide() or setVisible(false) is a bit more intuitive
and Qt-stylish than setState(NoProgressState).
Change-Id: I12138454299f53a09e37bb82b473163e49ac97b3
Reviewed-by: Ivan Vizir <define-true-false@yandex.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/winextras/qwintaskbarprogress.cpp')
-rw-r--r-- | src/winextras/qwintaskbarprogress.cpp | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/winextras/qwintaskbarprogress.cpp b/src/winextras/qwintaskbarprogress.cpp index fec4684..0225bf9 100644 --- a/src/winextras/qwintaskbarprogress.cpp +++ b/src/winextras/qwintaskbarprogress.cpp @@ -72,8 +72,6 @@ QT_BEGIN_NAMESPACE This enum type specifies the state of the progress indicator. - \value NoProgressState - No progress indicator is displayed. \value NormalState The progress indicator is green. \value PausedState @@ -91,11 +89,12 @@ public: int value; int minimum; int maximum; + bool visible; QWinTaskbarProgress::ProgressState state; }; QWinTaskbarProgressPrivate::QWinTaskbarProgressPrivate() : - value(0), minimum(0), maximum(100), state(QWinTaskbarProgress::NoProgressState) + value(0), minimum(0), maximum(100), visible(false), state(QWinTaskbarProgress::NormalState) { } @@ -118,7 +117,7 @@ QWinTaskbarProgress::~QWinTaskbarProgress() \property QWinTaskbarProgress::state \brief the state of the progress indicator - The default value is \c NoProgressState. + The default value is \c NormalState. */ QWinTaskbarProgress::ProgressState QWinTaskbarProgress::state() const { @@ -195,6 +194,44 @@ void QWinTaskbarProgress::setMaximum(int maximum) } /*! + \property QWinTaskbarProgress::visible + \brief the progress indicator is visible. + + The default value is \c false. + */ +bool QWinTaskbarProgress::isVisible() const +{ + Q_D(const QWinTaskbarProgress); + return d->visible; +} + +void QWinTaskbarProgress::setVisible(bool visible) +{ + Q_D(QWinTaskbarProgress); + if (visible == d->visible) + return; + + d->visible = visible; + emit visibilityChanged(d->visible); +} + +/*! + Shows the progress indicator. + */ +void QWinTaskbarProgress::show() +{ + setVisible(true); +} + +/*! + Hides the progress indicator. + */ +void QWinTaskbarProgress::hide() +{ + setVisible(false); +} + +/*! Sets both the \a minimum and \a maximum values. */ void QWinTaskbarProgress::setRange(int minimum, int maximum) @@ -212,13 +249,13 @@ void QWinTaskbarProgress::setRange(int minimum, int maximum) /*! Resets the progress indicator. - This function sets the state to \c NoProgressState and rewinds the + This function sets the state to \c NormalState and rewinds the value to the minimum value. */ void QWinTaskbarProgress::reset() { setValue(minimum()); - setState(NoProgressState); + setState(NormalState); } QT_END_NAMESPACE |