diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-08-27 11:35:39 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-08-29 22:05:09 +0200 |
commit | add8262f72befc4c6a25403a21269030111054d1 (patch) | |
tree | 5306de98a9fc7109851828eb0dc4a1a9a42fe15c /src/plugins/styles/android | |
parent | 62c08441099a4e561fe5b4ad644a11c2e1f4d2d8 (diff) |
Remove QStyleOptionProgressBar::orientation member
Address ### Qt 6 comment; the information is already stored in the
state variable, using the QStyle::State_Horizontal bit.
Change-Id: I61d143ba057776f9d622793a0592b5dd4726f25d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/styles/android')
-rw-r--r-- | src/plugins/styles/android/qandroidstyle.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/styles/android/qandroidstyle.cpp b/src/plugins/styles/android/qandroidstyle.cpp index 0a4e4286e0..8036655b04 100644 --- a/src/plugins/styles/android/qandroidstyle.cpp +++ b/src/plugins/styles/android/qandroidstyle.cpp @@ -1619,10 +1619,11 @@ void QAndroidStyle::AndroidProgressBarControl::drawControl(const QStyleOption *o if (m_progressDrawable->type() == QAndroidStyle::Layer) { const double fraction = double(qint64(pb->progress) - pb->minimum) / (qint64(pb->maximum) - pb->minimum); QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId); + const Qt::Orientation orientation = pb->state & QStyle::State_Horizontal ? Qt::Horizontal : Qt::Vertical; if (clipDrawable->type() == QAndroidStyle::Clip) - static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, pb->orientation); + static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, orientation); else - static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, pb->orientation); + static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, orientation); } m_progressDrawable->draw(p, option); } @@ -1634,7 +1635,7 @@ QRect QAndroidStyle::AndroidProgressBarControl::subElementRect(QStyle::SubElemen { if (const QStyleOptionProgressBar *progressBarOption = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { - const bool horizontal = progressBarOption->orientation == Qt::Vertical; + const bool horizontal = progressBarOption->state & QStyle::State_Horizontal; if (!m_background) return option->rect; @@ -1676,12 +1677,12 @@ QSize QAndroidStyle::AndroidProgressBarControl::sizeFromContents(const QStyleOpt if (const QStyleOptionProgressBar *progressBarOption = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) { - if (progressBarOption->orientation == Qt::Vertical) { - if (sz.height() > m_maxSize.height()) - sz.setHeight(m_maxSize.height()); - } else { + if (progressBarOption->state & QStyle::State_Horizontal) { if (sz.width() > m_maxSize.width()) sz.setWidth(m_maxSize.width()); + } else { + if (sz.height() > m_maxSize.height()) + sz.setHeight(m_maxSize.height()); } } return contentsSize; |