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
qqmlsettings_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QQMLSETTINGS_P_H
6#define QQMLSETTINGS_P_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
19#include <QtCore/qobject.h>
20#include <QtCore/qvariant.h>
21#include <QtCore/qurl.h>
22#include <QtQml/qqml.h>
23#include <QtQml/qqmlparserstatus.h>
24#include <QtQmlCore/private/qqmlcoreglobal_p.h>
25
26QT_BEGIN_NAMESPACE
27
28class QQmlSettingsPrivate;
29
30class Q_QMLCORE_EXPORT QQmlSettings : public QObject, public QQmlParserStatus
31{
32 Q_OBJECT
33 Q_INTERFACES(QQmlParserStatus)
34 Q_DECLARE_PRIVATE(QQmlSettings)
35 QML_NAMED_ELEMENT(Settings)
36 QML_ADDED_IN_VERSION(6, 5)
37
38 Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged FINAL)
39 Q_PROPERTY(QUrl location READ location WRITE setLocation NOTIFY locationChanged FINAL)
40
41public:
42 explicit QQmlSettings(QObject *parent = nullptr);
43 ~QQmlSettings() override;
44
45 QString category() const;
46 void setCategory(const QString &category);
47
48 QUrl location() const;
49 void setLocation(const QUrl &location);
50
51 Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = {}) const;
52 Q_INVOKABLE void setValue(const QString &key, const QVariant &value);
53 Q_INVOKABLE void sync();
54
55Q_SIGNALS:
56 void categoryChanged(const QString &arg);
57 void locationChanged(const QUrl &arg);
58
59protected:
60 void timerEvent(QTimerEvent *event) override;
61
62 void classBegin() override;
63 void componentComplete() override;
64
65private:
66 QScopedPointer<QQmlSettingsPrivate> d_ptr;
67
68 Q_PRIVATE_SLOT(d_func(), void _q_propertyChanged())
69};
70
71QT_END_NAMESPACE
72
73#endif // QQMLSETTINGS_P_H
QPointer< QSettings > settings
QHash< const char *, QVariant > changedProperties
QQmlSettings * q_ptr
QVariant readProperty(const QMetaProperty &property) const
~QQmlSettingsPrivate()=default
QSettings * instance() const
static constexpr auto settingsWriteDelay
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")