From 40683aaa4e461553289ae79fdae344084c43ca1c Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 31 Aug 2017 19:09:28 +0200 Subject: [PATCH] TextEditor: Prevent flashing window when switching to QML outline The reason for the flashing is that the toolbuttons in the toolbar are constructed without initial parent. The Filter toolbutton is set to visible before it is parented, and therefore it creates a top-level window. Milliseconds later it gets a parent and the window disappears. Task-number: QTCREATORBUG-18823 Change-Id: Ide100d9117484131007a4d4d2e584d0967aa7377 Reviewed-by: Eike Ziller --- src/plugins/texteditor/outlinefactory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index 31eeabde175..0b047890992 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -62,7 +62,11 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) : connect(m_toggleSync, &QAbstractButton::clicked, this, &OutlineWidgetStack::toggleCursorSynchronization); - m_filterButton = new QToolButton; + m_filterButton = new QToolButton(this); + // The ToolButton needs a parent because updateFilterMenu() sets + // it visible. That would open a top-level window if the button + // did not have a parent in that moment. + m_filterButton->setIcon(Utils::Icons::FILTER.icon()); m_filterButton->setToolTip(tr("Filter tree")); m_filterButton->setPopupMode(QToolButton::InstantPopup);