summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-09-25 13:03:25 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-01-05 15:01:43 +0000
commit5e9e4ccdc363297f70d4ebfbbb3e279670eca553 (patch)
tree1d91d087097a4a192b1cc8935f94806bf84e6a4c /tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
parentbef0db36ace4c49d77720e505e0953e1822d0d68 (diff)
Add an option to scroll the QComboBox on macOS with the mouse wheel
Since there may be some applications that want to make their comboboxes scrollable or not with the mouse wheel then a style hint is added to make this toggable. It defaults to true for all platforms except macOS to keep it in line with existing behavior. [ChangeLog][QtWidgets][QStyle] Added SH_ComboBox_AllowWheelScrolling as a style hint to enable/disable the use of the mouse wheel in a QComboBox. This defaults to true in all styles except the macOS one so there is no change in existing behavior. Task-number: QTBUG-53094 Change-Id: I6eb61e1990bfc79e3b3ea82d7b91ee39096fa077 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index c65cfa3e1a..0c229c9194 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -2052,13 +2052,13 @@ void tst_QComboBox::mouseWheel_data()
QTest::newRow("upper locked") << disabled << start << wheel << expected;
wheel = -1;
-#ifdef Q_OS_DARWIN
+ const bool allowsWheelScroll = QApplication::style()->styleHint(QStyle::SH_ComboBox_AllowWheelScrolling);
// on OS X & iOS mouse wheel shall have no effect on combo box
- expected = start;
-#else
- // on other OSes we should jump to next enabled item (no. 5)
- expected = 5;
-#endif
+ if (!allowsWheelScroll)
+ expected = start;
+ else // on other OSes we should jump to next enabled item (no. 5)
+ expected = 5;
+
QTest::newRow("jump over") << disabled << start << wheel << expected;
disabled.clear();