From b73549fd350b3fce84312c1329d6b65c289aef8a Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Tue, 14 Feb 2017 18:32:40 +0100 Subject: [PATCH] Fix a bug where the window would sometimes not show up after restoring from tray After this patch, the window will not have the window manager's restore animation anymore, but will be reliably shown --- src/gui/MainWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 879dd3c58..180aa3212 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -728,18 +728,19 @@ void MainWindow::toggleWindow() { if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) { setWindowState(windowState() | Qt::WindowMinimized); - hide(); - + QTimer::singleShot(0, this, SLOT(hide())); + if (config()->get("security/lockdatabaseminimize").toBool()) { m_ui->tabWidget->lockDatabases(); } - } - else { + } else { ensurePolished(); - show(); setWindowState(windowState() & ~Qt::WindowMinimized); - raise(); - activateWindow(); + QTimer::singleShot(0, this, [this]() { + show(); + raise(); + activateWindow(); + }); #if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS) // re-register global D-Bus menu (needed on Ubuntu with Unity)