From 7a6bb4d9c9eee46e5f2e0aee9a93d38fd6b91c46 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Nov 2013 09:12:06 +0100 Subject: 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 --- src/widgets/widgets/qtabbar.cpp | 23 ++++++----------------- src/widgets/widgets/qtabbar.h | 1 - 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'src/widgets') 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(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 *); -- cgit v1.2.3