QmlDesigner: Add explicit ownership to binding editor

It is much better to desribe the ownership explicitly instead of using
the hard to read parent child mechanism.

Change-Id: I488a6ca1fb08f4bf3b3a540c0bb7d9ffb03895d0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Marco Bubke
2024-02-26 16:18:42 +01:00
parent f6025c4e04
commit 12760b3032
6 changed files with 45 additions and 42 deletions

View File

@@ -49,12 +49,10 @@ void ActionEditor::prepareDialog()
s_lastActionEditor = this;
m_dialog = new ActionEditorDialog(Core::ICore::dialogParent());
m_dialog = Utils::makeUniqueObjectPtr<ActionEditorDialog>(Core::ICore::dialogParent());
QObject::connect(m_dialog, &AbstractEditorDialog::accepted,
this, &ActionEditor::accepted);
QObject::connect(m_dialog, &AbstractEditorDialog::rejected,
this, &ActionEditor::rejected);
QObject::connect(m_dialog.get(), &AbstractEditorDialog::accepted, this, &ActionEditor::accepted);
QObject::connect(m_dialog.get(), &AbstractEditorDialog::rejected, this, &ActionEditor::rejected);
m_dialog->setAttribute(Qt::WA_DeleteOnClose);
}
@@ -327,13 +325,13 @@ void ActionEditor::prepareConnections()
for (const QmlModelState &state : QmlItemNode(m_modelNode.view()->rootModelNode()).states().allStates())
states.append(state.name());
if (!connections.isEmpty() && !m_dialog.isNull())
if (!connections.isEmpty() && m_dialog)
m_dialog->setAllConnections(connections, singletons, states);
}
void ActionEditor::updateWindowName(const QString &targetName)
{
if (!m_dialog.isNull()) {
if (m_dialog) {
if (targetName.isEmpty())
m_dialog->setWindowTitle(m_dialog->defaultTitle());
else