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 <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2017-08-31 19:09:28 +02:00
parent 7f68088f3b
commit 40683aaa4e

View File

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