From b216b735060e589ab92bd23680423616105a4b6c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 20 Jul 2022 13:23:02 +0200 Subject: [PATCH] FormEditorStack: Avoid using sender() Change-Id: I35ea87d30eb3b3529d7c6b85febced75e3951dcf Reviewed-by: Eike Ziller Reviewed-by: --- src/plugins/designer/formeditorstack.cpp | 13 +++++-------- src/plugins/designer/formeditorstack.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/plugins/designer/formeditorstack.cpp b/src/plugins/designer/formeditorstack.cpp index d340f30fc12..2fae6d7fa95 100644 --- a/src/plugins/designer/formeditorstack.cpp +++ b/src/plugins/designer/formeditorstack.cpp @@ -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(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 diff --git a/src/plugins/designer/formeditorstack.h b/src/plugins/designer/formeditorstack.h index a49455f7522..728320a4db9 100644 --- a/src/plugins/designer/formeditorstack.h +++ b/src/plugins/designer/formeditorstack.h @@ -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;