diff options
Diffstat (limited to 'src/quicktemplates2/qquicktabbar.cpp')
-rw-r--r-- | src/quicktemplates2/qquicktabbar.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index f881058121..0297324e01 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -68,6 +68,8 @@ QT_BEGIN_NAMESPACE items dynamically at run time. The items can be accessed using \l {Container::}{itemAt()} or \l {Container::}{contentChildren}. + \include container-currentindex.qdocinc {file} {TabBar} {SwipeView} + \section2 Resizing Tabs By default, TabBar resizes its buttons to fit the width of the control. @@ -115,6 +117,9 @@ public: bool updatingLayout = false; QQuickTabBar::Position position = QQuickTabBar::Header; +#if QT_CONFIG(wheelevent) + QPoint accumulatedAngleDelta; +#endif }; class QQuickTabBarAttachedPrivate : public QObjectPrivate @@ -383,6 +388,26 @@ void QQuickTabBar::itemRemoved(int index, QQuickItem *item) polish(); } +#if QT_CONFIG(wheelevent) +void QQuickTabBar::wheelEvent(QWheelEvent *event) +{ + Q_D(QQuickTabBar); + QQuickContainer::wheelEvent(event); + if (d->wheelEnabled) { + d->accumulatedAngleDelta += event->angleDelta(); + int xSteps = d->accumulatedAngleDelta.x() / QWheelEvent::DefaultDeltasPerStep; + int ySteps = d->accumulatedAngleDelta.y() / QWheelEvent::DefaultDeltasPerStep; + if (xSteps > 0 || ySteps > 0) { + decrementCurrentIndex(); + d->accumulatedAngleDelta = QPoint(); + } else if (xSteps < 0 || ySteps < 0) { + incrementCurrentIndex(); + d->accumulatedAngleDelta = QPoint(); + } + } +} +#endif + QFont QQuickTabBar::defaultFont() const { return QQuickTheme::font(QQuickTheme::TabBar); @@ -479,3 +504,5 @@ QQuickTabBar::Position QQuickTabBarAttached::position() const } QT_END_NAMESPACE + +#include "moc_qquicktabbar_p.cpp" |