diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-11-08 09:12:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-08 10:44:06 +0100 |
commit | 7a6bb4d9c9eee46e5f2e0aee9a93d38fd6b91c46 (patch) | |
tree | e8d1164748fc393731f46ffc58ba7481d07b0181 /src/widgets/widgets | |
parent | ac7823129a529a71d2725fdeadc5eff7a2b0788a (diff) |
Fix potential BC break in QTabBar.
Move code from mouseDoubleClickEvent() to event().
Introduced by 252bad7c589e03d3e12df02354b00a84d8e3159a .
Task-number: QTBUG-34670
Change-Id: I98ed24f26977220cf03524cfe001524364473982
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qtabbar.cpp | 23 | ||||
-rw-r--r-- | src/widgets/widgets/qtabbar.h | 1 |
2 files changed, 6 insertions, 18 deletions
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 094e9af0de..dfd1f1022c 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1496,6 +1496,12 @@ bool QTabBar::event(QEvent *event) } } #endif + } else if (event->type() == QEvent::MouseButtonDblClick) { // ### fixme Qt 6: move to mouseDoubleClickEvent(), here for BC reasons. + const QPoint pos = static_cast<const QMouseEvent *>(event)->pos(); + const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos)) + || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos)); + if (!isEventInCornerButtons) + emit tabBarDoubleClicked(tabAt(pos)); } return QWidget::event(event); } @@ -1723,23 +1729,6 @@ void QTabBarPrivate::moveTab(int index, int offset) q_func()->update(); } - -/*! - \reimp -*/ -void QTabBar::mouseDoubleClickEvent(QMouseEvent *event) -{ - Q_D(QTabBar); - - const QPoint pos = event->pos(); - const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos)) - || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos)); - if (!isEventInCornerButtons) { - const int index = tabAt(pos); - emit tabBarDoubleClicked(index); - } -} - /*!\reimp */ void QTabBar::mousePressEvent(QMouseEvent *event) diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 1f7b8f6b03..a0e52c2f86 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -188,7 +188,6 @@ protected: void showEvent(QShowEvent *); void hideEvent(QHideEvent *); void paintEvent(QPaintEvent *); - void mouseDoubleClickEvent(QMouseEvent *); void mousePressEvent (QMouseEvent *); void mouseMoveEvent (QMouseEvent *); void mouseReleaseEvent (QMouseEvent *); |