diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-06 09:48:45 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-06 09:48:45 (GMT) |
commit | a80b082e9307aa819259590fd98ae135450930f1 (patch) | |
tree | 852d2525d19f665163236d33c0787fe8e6625b79 /src/gui/styles/qs60style.cpp | |
parent | b246f8a8beab858468777f433f49faf62edcb07e (diff) | |
download | Qt-a80b082e9307aa819259590fd98ae135450930f1.zip Qt-a80b082e9307aa819259590fd98ae135450930f1.tar.gz Qt-a80b082e9307aa819259590fd98ae135450930f1.tar.bz2 |
S60Style: Add support for busy indicator for progres bar.
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 87353f9..ae639d7 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1472,21 +1472,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_ProgressBarContents: if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) { QRect progressRect = optionProgressBar->rect; - const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 - : (qreal)optionProgressBar->progress / optionProgressBar->maximum; - if (optionProgressBar->orientation == Qt::Horizontal) { - progressRect.setWidth(int(progressRect.width() * progressFactor)); - if(optionProgressBar->direction == Qt::RightToLeft) - progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0); - progressRect.adjust(1, 0, -1, 0); + + if (optionProgressBar->minimum == optionProgressBar->maximum && optionProgressBar->minimum == 0) { + // busy indicator + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect,flags); } else { - progressRect.adjust(0, 1, 0, -1); - progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor)); + const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 + : (qreal)optionProgressBar->progress / optionProgressBar->maximum; + if (optionProgressBar->orientation == Qt::Horizontal) { + progressRect.setWidth(int(progressRect.width() * progressFactor)); + if(optionProgressBar->direction == Qt::RightToLeft) + progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0); + progressRect.adjust(1, 0, -1, 0); + } else { + progressRect.adjust(0, 1, 0, -1); + progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor)); + } + + const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ? + QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical; + QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags); } - - const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ? - QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical; - QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags); } break; case CE_ProgressBarGroove: |