diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-27 12:42:48 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-01 23:09:54 +0200 |
commit | 199329c9df889d371dc5f717248fcc519e8952e3 (patch) | |
tree | 7cf4d9ccff1253aef4f6e05bf5c997c14edecdc5 /src/designer/src/components/formeditor/qdesigner_resource.cpp | |
parent | b5bf195dc9c7576f627f37428c5ff2ff6e958411 (diff) |
Qt Designer: Add a setting for calling connectSlotsByName()
Add a boolean attribute to DomUI and a form setting, allowing for
per-form migration to the Qt 5 connection syntax.
[ChangeLog][Designer] A per-form setting for disabling generating
calls to QObject::connectSlotsByName() has been added to support
migrating forms to Qt 5 connection syntax.
Task-number: QTBUG-76375
Change-Id: Id59d4689287fdec025c199e4efc87a919e37ae9e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/components/formeditor/qdesigner_resource.cpp')
-rw-r--r-- | src/designer/src/components/formeditor/qdesigner_resource.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index 4b747d04c..dd1144d7c 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -512,6 +512,8 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget) if (m_formWindow->useIdBasedTranslations()) ui->setAttributeIdbasedtr(true); + if (!m_formWindow->connectSlotsByName()) // Don't write out if true (default) + ui->setAttributeConnectslotsbyname(false); const QVariantMap designerFormData = m_formWindow->formData(); if (!designerFormData.empty()) { @@ -646,8 +648,12 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget) QDesignerWidgetItemInstaller wii; // Make sure we use QDesignerWidgetItem. QWidget *mainWidget = QAbstractFormBuilder::create(ui, parentWidget); - if (m_formWindow) + if (m_formWindow) { m_formWindow->setUseIdBasedTranslations(ui->attributeIdbasedtr()); + // Default to true unless set. + const bool connectSlotsByName = !ui->hasAttributeConnectslotsbyname() || ui->attributeConnectslotsbyname(); + m_formWindow->setConnectSlotsByName(connectSlotsByName); + } if (mainWidget && m_formWindow) { m_formWindow->setAuthor(ui->elementAuthor()); |