summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm3
-rw-r--r--src/widgets/styles/qstyleoption.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.h1
-rw-r--r--src/widgets/widgets/qscrollbar.cpp1
4 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 91611f9db5..6563e95ceb 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -2644,7 +2644,8 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_ScrollBar_LeftClickAbsolutePosition: {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
- if(QApplication::keyboardModifiers() & Qt::AltModifier)
+ const QStyleOptionSlider *sliderOpt = qstyleoption_cast<const QStyleOptionSlider*>(opt);
+ if (sliderOpt && sliderOpt->keyboardModifiers & Qt::AltModifier)
ret = !result;
else
ret = result;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index c2ab864c22..4624c6e7f0 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1966,7 +1966,7 @@ QStyleOptionSlider::QStyleOptionSlider()
: QStyleOptionComplex(Version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
- dialWrapping(false)
+ dialWrapping(false), keyboardModifiers{}
{
}
@@ -1977,7 +1977,7 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
: QStyleOptionComplex(version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
- dialWrapping(false)
+ dialWrapping(false), keyboardModifiers{}
{
}
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index b81e48c669..38f2c98e38 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -527,6 +527,7 @@ public:
int pageStep;
qreal notchTarget;
bool dialWrapping;
+ Qt::KeyboardModifiers keyboardModifiers;
QStyleOptionSlider();
QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; }
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 59575b9f2b..cf2a3c5bfe 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -553,6 +553,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
nullptr, this);
QStyleOptionSlider opt;
initStyleOption(&opt);
+ opt.keyboardModifiers = e->modifiers();
if (d->maximum == d->minimum // no range
|| (e->buttons() & (~e->button())) // another button was clicked before