Fix potential BC break in QTabBar.

Move code from mouseDoubleClickEvent() to event().
Introduced by 252bad7c58 .

Task-number: QTBUG-34670
Change-Id: I98ed24f26977220cf03524cfe001524364473982
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Friedemann Kleint 2013-11-08 09:12:06 +01:00 committed by The Qt Project
parent ac7823129a
commit 7a6bb4d9c9
2 changed files with 6 additions and 18 deletions

View File

@ -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)

View File

@ -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 *);