diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-11-28 16:10:37 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-11-29 09:22:57 +0000 |
commit | 1f34461088946ac710c163c3aa4678360f06062b (patch) | |
tree | fe899956f84a3b515cf4813264a870a3232a5589 /src/plugins/designer | |
parent | 8d851fab0baf04a3602444eea89f29cc089fb81f (diff) |
IMode: Make main window an (optional) property
Un-virtualize IMode::mainWindow. If the mode widget is a main window
directly, that is handled automatically, otherwise provide a setter. It
is better to have a central point for setting it, in case that it isn't
the mode widget in the first place. Also, using Aggregation::query for
this is actually a misuse of Aggregate, which is supposed to combine
_independent_ objects, not objects that are in the same hierarchy (which
can crash if the child object is deleted first).
Change-Id: I35381e0a05645022aac72501492ea6347953cd55
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/designer')
-rw-r--r-- | src/plugins/designer/formeditor.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/designer/formeditor.cpp b/src/plugins/designer/formeditor.cpp index 57075e7ecc2..57bb78f5a5a 100644 --- a/src/plugins/designer/formeditor.cpp +++ b/src/plugins/designer/formeditor.cpp @@ -407,10 +407,6 @@ void FormEditorData::fullInit() m_modeWidget = new QWidget; m_modeWidget->setObjectName("DesignerModeWidget"); - // make the editor widget (the dockable widget) accessible via the mode widget - auto agg = new Aggregation::Aggregate; - agg->add(m_modeWidget); - agg->add(m_editorWidget); auto layout = new QVBoxLayout(m_modeWidget); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -427,7 +423,10 @@ void FormEditorData::fullInit() designerContexts.add(Core::Constants::C_EDITORMANAGER); ICore::addContextObject(new DesignerContext(designerContexts, m_modeWidget, this)); - DesignMode::registerDesignWidget(m_modeWidget, QStringList(Utils::Constants::FORM_MIMETYPE), m_contexts); + DesignMode::registerDesignWidget(m_modeWidget, + QStringList(Utils::Constants::FORM_MIMETYPE), + m_contexts, + m_editorWidget); setupViewActions(); |