aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-10-19 11:08:57 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2020-10-19 13:23:12 +0200
commit3a4e62f9b1efee7b1fd0b5e34fca6687be64abfa (patch)
treed9a294565c3ce579ce2c4eef8ddf8f2638923a4a /src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
parent917f7ceb9fda6f5e54658d2588358635d5dfbb85 (diff)
Nativestyle: Slider on Windows
Change-Id: Iab1f01a2cccad21e178aaf13ea21469a5ce98fea Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp')
-rw-r--r--src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
index 69180c62..e40cedb0 100644
--- a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
+++ b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
@@ -2722,7 +2722,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
theme.stateId = stateId;
d->drawBackground(theme);
}
- if (slider->state & State_HasFocus) {
+ if (sub & SC_SliderGroove && slider->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = subElementRect(SE_SliderFocusRect, slider);
@@ -3446,6 +3446,30 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
}
break;
+ case CT_Slider:
+ if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ QStyle::SubControls sub = slider->subControls;
+ const int TickSpace = 5;
+ int thick = proxy()->pixelMetric(QStyle::PM_SliderThickness, slider);
+
+ if (slider->tickPosition & QStyleOptionSlider::TicksAbove)
+ thick += TickSpace;
+ if (slider->tickPosition & QStyleOptionSlider::TicksBelow)
+ thick += TickSpace;
+ sz.setWidth(thick);
+
+ if (sub & SC_SliderGroove) {
+ const int SliderLength = 84;
+ sz.setHeight(SliderLength);
+ }
+ if (slider->orientation == Qt::Horizontal)
+ sz.transpose();
+ if (sub & SC_SliderHandle) {
+ const QSize s = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle).size();
+ sz = sz.expandedTo(s);
+ }
+ }
+ break;
default:
sz = QWindowsStyle::sizeFromContents(ct, option, sz);
break;