FormEditorStack: Avoid using sender()

Change-Id: I35ea87d30eb3b3529d7c6b85febced75e3951dcf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-07-20 13:23:02 +02:00
parent 867c09cb7e
commit b216b73506
2 changed files with 6 additions and 9 deletions

View File

@@ -84,8 +84,8 @@ void FormEditorStack::add(const EditorData &data)
connect(data.formWindowEditor, &FormWindowEditor::destroyed,
this, &FormEditorStack::removeFormWindowEditor);
connect(data.widgetHost, &SharedTools::WidgetHost::formWindowSizeChanged,
this, &FormEditorStack::formSizeChanged);
connect(data.widgetHost, &SharedTools::WidgetHost::formWindowSizeChanged, this,
[this, wh = data.widgetHost](int w, int h) { formSizeChanged(wh, w, h); });
if (Designer::Constants::Internal::debug)
qDebug() << "FormEditorStack::add" << data.widgetHost << m_formEditors.size();
@@ -168,16 +168,13 @@ void FormEditorStack::updateFormWindowSelectionHandles()
}
}
void FormEditorStack::formSizeChanged(int w, int h)
void FormEditorStack::formSizeChanged(const SharedTools::WidgetHost *widgetHost, int w, int h)
{
// Handle main container resize.
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << w << h;
if (auto wh = qobject_cast<const SharedTools::WidgetHost *>(sender())) {
wh->formWindow()->setDirty(true);
static const QString geometry = "geometry";
m_designerCore->propertyEditor()->setPropertyValue(geometry, QRect(0,0,w,h) );
}
widgetHost->formWindow()->setDirty(true);
m_designerCore->propertyEditor()->setPropertyValue("geometry", QRect(0, 0, w, h));
}
SharedTools::WidgetHost *FormEditorStack::formWindowEditorForXmlEditor(const Core::IEditor *xmlEditor) const

View File

@@ -68,7 +68,7 @@ public:
private:
void updateFormWindowSelectionHandles();
void modeAboutToChange(Utils::Id mode);
void formSizeChanged(int w, int h);
void formSizeChanged(const SharedTools::WidgetHost *widgetHost, int w, int h);
inline int indexOfFormWindow(const QDesignerFormWindowInterface *) const;
inline int indexOfFormEditor(const QObject *xmlEditor) const;