Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickdesignercustomobjectdata_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef DESIGNERCUSTOMOBJECTDATA_H
6#define DESIGNERCUSTOMOBJECTDATA_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20
21#include <QHash>
22#include <QObject>
23#include <QVariant>
24
25#include <private/qqmlanybinding_p.h>
26
28class QQmlContext;
29
31{
32public:
33 static void registerData(QObject *object);
34 static QQuickDesignerCustomObjectData *get(QObject *object);
35 static QVariant getResetValue(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName);
36 static void doResetProperty(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName);
37 static bool hasValidResetBinding(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName);
38 static bool hasBindingForProperty(QObject *object,
39 QQmlContext *context,
40 const QQuickDesignerSupport::PropertyName &propertyName,
41 bool *hasChanged);
42 static void setPropertyBinding(QObject *object,
43 QQmlContext *context,
44 const QQuickDesignerSupport::PropertyName &propertyName,
45 const QString &expression);
46 static void keepBindingFromGettingDeleted(QObject *object,
47 QQmlContext *context,
48 const QQuickDesignerSupport::PropertyName &propertyName);
49 void handleDestroyed();
50
51private:
52 QQuickDesignerCustomObjectData(QObject *object);
53 void populateResetHashes();
54 QObject *object() const;
55 QVariant getResetValue(const QQuickDesignerSupport::PropertyName &propertyName) const;
56 void doResetProperty(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName);
57 bool hasValidResetBinding(const QQuickDesignerSupport::PropertyName &propertyName) const;
58 QQmlAnyBinding getResetBinding(const QQuickDesignerSupport::PropertyName &propertyName) const;
59 bool hasBindingForProperty(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName, bool *hasChanged) const;
60 void setPropertyBinding(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName, const QString &expression);
61 void keepBindingFromGettingDeleted(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName);
62
63 QObject *m_object;
64 QHash<QQuickDesignerSupport::PropertyName, QVariant> m_resetValueHash;
65 QHash<QQuickDesignerSupport::PropertyName, QQmlAnyBinding> m_resetBindingHash;
66 mutable QHash<QQuickDesignerSupport::PropertyName, bool> m_hasBindingHash;
67};
68
69QT_END_NAMESPACE
70
71#endif // DESIGNERCUSTOMOBJECTDATA_H
static void doResetProperty(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName)
static void setPropertyBinding(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName, const QString &expression)
static bool hasValidResetBinding(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName)
static QVariant getResetValue(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName)
static bool hasBindingForProperty(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName, bool *hasChanged)
static void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName)
static QQuickDesignerCustomObjectData * get(QObject *object)
Combined button and popup list for selecting options.
Q_GLOBAL_STATIC(QReadWriteLock, g_updateMutex)
QHash< QObject *, QQuickDesignerCustomObjectData * > CustomObjectDataHash
QQuickDesignerCustomObjectData * data