From fcf274b76887d784d9550861aaf461e9324af2b7 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 24 Mar 2018 23:04:14 +0100 Subject: [PATCH] TabIcon: Force resize to correct size Fixes tab icon taking full space even when hidden on restored tabs with empty icon with windows theme. --- src/lib/tabwidget/tabicon.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/tabwidget/tabicon.cpp b/src/lib/tabwidget/tabicon.cpp index 5e39292cd..670196ff2 100644 --- a/src/lib/tabwidget/tabicon.cpp +++ b/src/lib/tabwidget/tabicon.cpp @@ -128,7 +128,7 @@ void TabIcon::show() m_hideTimer->stop(); - if (isVisible()) { + if (isVisible() && width() == 16) { return; } @@ -139,7 +139,11 @@ void TabIcon::show() void TabIcon::hide() { - if (shouldBeVisible() || isHidden()) { + if (shouldBeVisible()) { + return; + } + + if (isHidden() && width() == 1) { return; } @@ -165,6 +169,13 @@ bool TabIcon::event(QEvent *event) event->accept(); return true; } + } else if (event->type() == QEvent::Resize) { + // Force resize to correct size + if (isVisible()) { + QTimer::singleShot(0, this, &TabIcon::show); + } else { + QTimer::singleShot(0, this, &TabIcon::hide); + } } return QWidget::event(event);