Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlpropertymap.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
4#ifndef QQMLPROPERTYMAP_H
5#define QQMLPROPERTYMAP_H
6
7#include <QtQml/qtqmlglobal.h>
8
9#include <QtCore/QObject>
10#include <QtCore/QHash>
11#include <QtCore/QStringList>
12#include <QtCore/QVariant>
13
15
16
18class Q_QML_EXPORT QQmlPropertyMap : public QObject
19{
21public:
22 explicit QQmlPropertyMap(QObject *parent = nullptr);
23 ~QQmlPropertyMap() override;
24
25 QVariant value(const QString &key) const;
26 void insert(const QString &key, const QVariant &value);
27 void insert(const QVariantHash &values);
28 void clear(const QString &key);
29 void freeze();
30
32
33 int count() const;
34 int size() const;
35 bool isEmpty() const;
36 bool contains(const QString &key) const;
37
38 QVariant &operator[](const QString &key);
39 QVariant operator[](const QString &key) const;
40
42 void valueChanged(const QString &key, const QVariant &value);
43
44protected:
45 virtual QVariant updateValue(const QString &key, const QVariant &input);
46
47 template<class DerivedType>
48 QQmlPropertyMap(DerivedType *derived, QObject *parentObj)
49 : QQmlPropertyMap(&DerivedType::staticMetaObject, parentObj)
50 {
52 }
53
54private:
55 QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *parent);
56
57 Q_DECLARE_PRIVATE(QQmlPropertyMap)
58 Q_DISABLE_COPY(QQmlPropertyMap)
59};
60
62
63#endif
\inmodule QtCore
Definition qobject.h:103
The QQmlPropertyMap class allows you to set key-value pairs that can be used in QML bindings.
void valueChanged(const QString &key, const QVariant &value)
This signal is emitted whenever one of the values in the map is changed.
QQmlPropertyMap(DerivedType *derived, QObject *parentObj)
Constructs a bindable map with parent object parent.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
b clear()
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool contains(const QJsonArray &haystack, unsigned needle)
Definition qopengl.cpp:116
GLenum GLsizei GLsizei GLint * values
[15]
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLenum GLenum input
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SIGNALS
#define Q_UNUSED(x)
QStringList keys
QExplicitlySharedDataPointer< Derived > derived(base)
\inmodule QtCore