diff --git a/src/lib/tabwidget/combotabbar.cpp b/src/lib/tabwidget/combotabbar.cpp index b8f3a8a24..e0bf03bf0 100644 --- a/src/lib/tabwidget/combotabbar.cpp +++ b/src/lib/tabwidget/combotabbar.cpp @@ -588,6 +588,17 @@ bool ComboTabBar::event(QEvent *event) ensureVisible(); break; + case QEvent::Show: + if (!event->spontaneous()) + QTimer::singleShot(0, this, &ComboTabBar::setUpLayout); + break; + + case QEvent::Enter: + case QEvent::Leave: + // Make sure tabs are painted with correct mouseover state + QTimer::singleShot(100, this, &ComboTabBar::updateTabBars); + break; + default: break; } @@ -906,31 +917,6 @@ void ComboTabBar::setMinimumWidths() } } -void ComboTabBar::showEvent(QShowEvent* event) -{ - if (!event->spontaneous()) { - QTimer::singleShot(0, this, SLOT(setUpLayout())); - } - - QWidget::showEvent(event); -} - -void ComboTabBar::enterEvent(QEvent* event) -{ - QWidget::enterEvent(event); - - // Make sure tabs are painted with correct mouseover state - QTimer::singleShot(100, this, SLOT(updateTabBars())); -} - -void ComboTabBar::leaveEvent(QEvent* event) -{ - QWidget::leaveEvent(event); - - // Make sure tabs are painted with correct mouseover state - QTimer::singleShot(100, this, SLOT(updateTabBars())); -} - TabBarHelper::TabBarHelper(bool isPinnedTabBar, ComboTabBar* comboTabBar) : QTabBar(comboTabBar) diff --git a/src/lib/tabwidget/combotabbar.h b/src/lib/tabwidget/combotabbar.h index 06c268515..64c947e76 100644 --- a/src/lib/tabwidget/combotabbar.h +++ b/src/lib/tabwidget/combotabbar.h @@ -167,9 +167,6 @@ protected: bool event(QEvent *event); void wheelEvent(QWheelEvent* event); - void showEvent(QShowEvent* event); - void enterEvent(QEvent* event); - void leaveEvent(QEvent* event); bool eventFilter(QObject* obj, QEvent* ev); void paintEvent(QPaintEvent* ev);