QmlDesigner: Fix floating widgets on start up

Task-number: QDS-7423
Change-Id: I273b8a3926b574f4ec61500b798bff578684cb1f
Reviewed-by: Brook Cronin <brook.cronin@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Henning Gruendl
2022-08-15 15:53:39 +02:00
committed by Henning Gründl
parent fea338c000
commit 305517f212

View File

@@ -390,19 +390,26 @@ void DesignModeWidget::setup()
m_dockManager->initialize();
// Hide all floating widgets if the initial mode isn't design mode
if (Core::ModeManager::instance()->currentModeId() != Core::Constants::MODE_DESIGN) {
for (auto &floatingWidget : m_dockManager->floatingWidgets())
floatingWidget->hide();
}
connect(Core::ModeManager::instance(),
&Core::ModeManager::currentModeChanged,
this,
[this](Utils::Id mode, Utils::Id oldMode) {
[this](Utils::Id mode, Utils::Id previousMode) {
if (mode == Core::Constants::MODE_DESIGN) {
m_dockManager->reloadActiveWorkspace();
m_dockManager->setModeChangeState(false);
}
if (oldMode == Core::Constants::MODE_DESIGN && mode != Core::Constants::MODE_DESIGN) {
if (previousMode == Core::Constants::MODE_DESIGN
&& mode != Core::Constants::MODE_DESIGN) {
m_dockManager->save();
m_dockManager->setModeChangeState(true);
for (auto floatingWidget : m_dockManager->floatingWidgets())
for (auto &floatingWidget : m_dockManager->floatingWidgets())
floatingWidget->hide();
}
});