summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-24 15:58:56 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-24 16:41:13 +0000
commit8875096e241b2371828ce6814a62afe67fb294ef (patch)
treee534e1afb7e26488e01bb2a0db5fcd56ab7de65b
parent3dc43cc76455fe694c4069557c9ceeaea0a80aaf (diff)
downloadqttools-8875096e241b2371828ce6814a62afe67fb294ef.tar.gz
Qt Designer: Disambiguate static helper formEditorForObject()
Make it a static member of QDesignerPropertySheet. Task-number: QTBUG-109394 Change-Id: Ia14362be932a0ea25a26c4009b200acb8dfe4f98 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit 3c3ed0353ef1b0c36c8173f6df63c8273e2b0337) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet.cpp17
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp30
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet_p.h2
3 files changed, 19 insertions, 30 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
index c4aded26d..eb48d65d3 100644
--- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_membersheet_p.h"
+#include "qdesigner_propertysheet_p.h"
#include <QtDesigner/abstractformeditor.h>
#include <abstractintrospection_p.h>
@@ -20,20 +21,6 @@ static QList<QByteArray> stringListToByteArray(const QStringList &l)
return rc;
}
-// Find the form editor in the hierarchy.
-// We know that the parent of the sheet is the extension manager
-// whose parent is the core.
-
-static QDesignerFormEditorInterface *formEditorForObject(QObject *o) {
- do {
- if (QDesignerFormEditorInterface* core = qobject_cast<QDesignerFormEditorInterface*>(o))
- return core;
- o = o->parent();
- } while(o);
- Q_ASSERT(o);
- return nullptr;
-}
-
// ------------ QDesignerMemberSheetPrivate
class QDesignerMemberSheetPrivate {
public:
@@ -56,7 +43,7 @@ public:
};
QDesignerMemberSheetPrivate::QDesignerMemberSheetPrivate(QObject *object, QObject *sheetParent) :
- m_core(formEditorForObject(sheetParent)),
+ m_core(QDesignerPropertySheet::formEditorForObject(sheetParent)),
m_meta(m_core->introspection()->metaObject(object))
{
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index a61c4ad1e..d856b9b8d 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -77,20 +77,6 @@ static const char *layoutGridColumnStretchPropertyC = "layoutColumnStretch";
static const char *layoutGridRowMinimumHeightC = "layoutRowMinimumHeight";
static const char *layoutGridColumnMinimumWidthC = "layoutColumnMinimumWidth";
-// Find the form editor in the hierarchy.
-// We know that the parent of the sheet is the extension manager
-// whose parent is the core.
-
-static QDesignerFormEditorInterface *formEditorForObject(QObject *o) {
- do {
- if (QDesignerFormEditorInterface* core = qobject_cast<QDesignerFormEditorInterface*>(o))
- return core;
- o = o->parent();
- } while(o);
- Q_ASSERT(o);
- return nullptr;
-}
-
static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *object)
{
if (!object->isWidgetType())
@@ -367,7 +353,7 @@ void QDesignerPropertySheetPrivate::setKeySequenceProperty(int index, const qdes
QDesignerPropertySheetPrivate::QDesignerPropertySheetPrivate(QDesignerPropertySheet *sheetPublic, QObject *object, QObject *sheetParent) :
q(sheetPublic),
- m_core(formEditorForObject(sheetParent)),
+ m_core(QDesignerPropertySheet::formEditorForObject(sheetParent)),
m_meta(m_core->introspection()->metaObject(object)),
m_objectType(QDesignerPropertySheet::objectTypeFromObject(object)),
m_objectFlags(QDesignerPropertySheet::objectFlagsFromObject(object)),
@@ -1632,6 +1618,20 @@ void QDesignerPropertySheet::setInternalDynamicPropertiesEnabled(bool v)
QDesignerPropertySheetPrivate::m_internalDynamicPropertiesEnabled = v;
}
+// Find the form editor in the hierarchy.
+// We know that the parent of the sheet is the extension manager
+// whose parent is the core.
+QDesignerFormEditorInterface *QDesignerPropertySheet::formEditorForObject(QObject *o)
+{
+ do {
+ if (auto *core = qobject_cast<QDesignerFormEditorInterface*>(o))
+ return core;
+ o = o->parent();
+ } while (o);
+ Q_ASSERT(o);
+ return nullptr;
+}
+
// ---------- QDesignerAbstractPropertySheetFactory
struct QDesignerAbstractPropertySheetFactory::PropertySheetFactoryPrivate {
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
index f5c82bb4b..6cfc4efed 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
@@ -94,6 +94,8 @@ public:
static bool internalDynamicPropertiesEnabled();
static void setInternalDynamicPropertiesEnabled(bool v);
+ static QDesignerFormEditorInterface *formEditorForObject(QObject *o);
+
protected:
bool isAdditionalProperty(int index) const;
bool isFakeProperty(int index) const;