diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-10 07:58:06 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-10 07:58:06 +0100 |
commit | 015002fec9abff6a4c1bb3fa4b9de87279a079c3 (patch) | |
tree | ad93af535a503d0a49d6c6367e990a8fbca163d3 /src/widgets/styles | |
parent | f1e00262321cc8daa3c7506153653453e2779886 (diff) | |
parent | b9547af45ea2bbbc634722c1ef41afdb54216ce2 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
doc/global/template/style/online.css
mkspecs/android-g++/qmake.conf
Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qandroidstyle.cpp | 32 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 7 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 3 |
5 files changed, 37 insertions, 10 deletions
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp index 5b4b346da9..a5a75dae02 100644 --- a/src/widgets/styles/qandroidstyle.cpp +++ b/src/widgets/styles/qandroidstyle.cpp @@ -1719,28 +1719,43 @@ void QAndroidStyle::AndroidSeekBarControl::drawControl(const QStyleOption *optio qstyleoption_cast<const QStyleOptionSlider *>(option)) { double factor = double(styleOption->sliderPosition - styleOption->minimum) / double(styleOption->maximum - styleOption->minimum); + + // Android does not have a vertical slider. To support the vertical orientation, we rotate + // the painter and pretend that we are horizontal. + if (styleOption->orientation == Qt::Vertical) + factor = 1 - factor; + if (m_progressDrawable->type() == QAndroidStyle::Layer) { QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId); if (clipDrawable->type() == QAndroidStyle::Clip) - static_cast<QAndroidStyle::AndroidClipDrawable *>(clipDrawable)->setFactor(factor, styleOption->orientation); + static_cast<QAndroidStyle::AndroidClipDrawable *>(clipDrawable)->setFactor(factor, Qt::Horizontal); else - static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, factor, styleOption->orientation); + static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, factor, Qt::Horizontal); } const AndroidDrawable *drawable = m_seekBarThumb; if (drawable->type() == State) drawable = static_cast<const QAndroidStyle::AndroidStateDrawable *>(m_seekBarThumb)->bestAndroidStateMatch(option); QStyleOption copy(*option); + + p->save(); + + if (styleOption->orientation == Qt::Vertical) { + // rotate the painter, and transform the rectangle to match + p->rotate(90); + copy.rect = QRect(copy.rect.y(), copy.rect.x() - copy.rect.width(), copy.rect.height(), copy.rect.width()); + } + copy.rect.setHeight(m_progressDrawable->size().height()); copy.rect.setWidth(copy.rect.width() - drawable->size().width()); const int yTranslate = abs(drawable->size().height() - copy.rect.height()) / 2; copy.rect.translate(drawable->size().width() / 2, yTranslate); m_progressDrawable->draw(p, ©); - if (styleOption->orientation == Qt::Vertical) - qCritical() << "Vertical slider are not supported"; int pos = copy.rect.width() * factor - drawable->size().width() / 2; copy.rect.translate(pos, -yTranslate); copy.rect.setSize(drawable->size()); m_seekBarThumb->draw(p, ©); + + p->restore(); } } @@ -1772,8 +1787,13 @@ QRect QAndroidStyle::AndroidSeekBarControl::subControlRect(const QStyleOptionCom QRect r(option->rect); double factor = double(styleOption->sliderPosition - styleOption->minimum) / (styleOption->maximum - styleOption->minimum); - int pos = option->rect.width() * factor - double(drawable->size().width() / 2); - r.setX(r.x() + pos); + if (styleOption->orientation == Qt::Vertical) { + int pos = option->rect.height() * (1 - factor) - double(drawable->size().height() / 2); + r.setY(r.y() + pos); + } else { + int pos = option->rect.width() * factor - double(drawable->size().width() / 2); + r.setX(r.x() + pos); + } r.setSize(drawable->size()); return r; } diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7e9a631c5e..6b8cba1b18 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4587,7 +4587,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = int(QStyleHelper::dpiScaled(4.)); break; case PM_HeaderMarkSize: - ret = int(QStyleHelper::dpiScaled(32.)); + ret = int(QStyleHelper::dpiScaled(16.)); break; case PM_HeaderGripMargin: ret = int(QStyleHelper::dpiScaled(4.)); @@ -4907,10 +4907,13 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_TabBar_Alignment: - case SH_Header_ArrowAlignment: ret = Qt::AlignLeft; break; + case SH_Header_ArrowAlignment: + ret = Qt::AlignRight | Qt::AlignVCenter; + break; + case SH_TitleBar_AutoRaise: ret = false; break; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 328378cb8e..3918b874e6 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -5592,7 +5592,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex CGContextTranslateCTM(ctx, 0, rect.size.height); CGContextScaleCTM(ctx, 1, -1); } - [sl.cell drawBarInside:tdi.bounds flipped:NO]; + [sl.cell drawBarInside:NSRectFromCGRect(tdi.bounds) flipped:NO]; // No need to restore the CTM later, the context has been saved // and will be restored at the end of drawNSViewInRect() }); diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 109a0ea451..2d5f676b65 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1663,7 +1663,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value SH_Header_ArrowAlignment The placement of the sorting indicator may appear in list or table headers. Possible values - are Qt::Left or Qt::Right. + are Qt::Alignment values (that is, an OR combination of + Qt::AlignmentFlag flags). \value SH_Slider_SnapToValue Sliders snap to values while moving, as they do on Windows. diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 463b120e04..42a85e8f64 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -2112,6 +2112,9 @@ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, co else ret = -1; break; + case SH_Header_ArrowAlignment: + ret = Qt::AlignTop | Qt::AlignHCenter; + break; default: ret = QWindowsXPStyle::styleHint(hint, option, widget, returnData); break; |