summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp3
-rw-r--r--src/widgets/styles/qstyle.cpp5
-rw-r--r--src/widgets/styles/qstyle.h1
-rw-r--r--src/widgets/widgets/qtabbar.cpp16
4 files changed, 16 insertions, 9 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 5c5b25cc94..fd618149ac 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5407,6 +5407,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_SpinBox_StepModifier:
ret = Qt::ControlModifier;
break;
+ case SH_TabBar_AllowWheelScrolling:
+ ret = true;
+ break;
default:
ret = 0;
break;
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 9f49a55386..c839afd639 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -2005,6 +2005,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
disables this feature.
This enum value has been introduced in Qt 5.12.
+ \value SH_TabBar_AllowWheelScrolling
+ Determines if the mouse wheel can be used to cycle through the tabs
+ of a QTabBar.
+ This enum value has been introduced in Qt 6.1.
+
\sa styleHint()
*/
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index ec13fdb80d..ba64a6b1bf 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -733,6 +733,7 @@ public:
SH_ComboBox_AllowWheelScrolling,
SH_SpinBox_ButtonsInsideFrame,
SH_SpinBox_StepModifier,
+ SH_TabBar_AllowWheelScrolling,
// Add new style hint values here
SH_CustomBase = 0xf0000000
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index b21e038843..a390f9ec0d 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2363,16 +2363,14 @@ void QTabBar::keyPressEvent(QKeyEvent *event)
#if QT_CONFIG(wheelevent)
void QTabBar::wheelEvent(QWheelEvent *event)
{
-#ifndef Q_OS_MAC
Q_D(QTabBar);
- int delta = (qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y()) ?
- event->angleDelta().x() : event->angleDelta().y());
- int offset = delta > 0 ? -1 : 1;
- d->setCurrentNextEnabledIndex(offset);
- QWidget::wheelEvent(event);
-#else
- Q_UNUSED(event);
-#endif
+ if (style()->styleHint(QStyle::SH_TabBar_AllowWheelScrolling)) {
+ int delta = (qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y()) ?
+ event->angleDelta().x() : event->angleDelta().y());
+ int offset = delta > 0 ? -1 : 1;
+ d->setCurrentNextEnabledIndex(offset);
+ QWidget::wheelEvent(event);
+ }
}
#endif // QT_CONFIG(wheelevent)