6#include <QtQml/qjsvalue.h>
7#include <QtQml/qqmlfile.h>
8#include <QtQml/qqmlinfo.h>
10#include <QtCore/qcoreapplication.h>
11#include <QtCore/qcoreevent.h>
12#include <QtCore/qdebug.h>
13#include <QtCore/qhash.h>
14#include <QtCore/qloggingcategory.h>
15#include <QtCore/qpointer.h>
16#include <QtCore/qsettings.h>
224 void _q_propertyChanged();
229 bool initialized =
false;
233 QHash<const char *, QVariant> changedProperties = {};
254 missingIdentifiers.append(u
"organizationName"_s);
256 missingIdentifiers.append(u
"organizationDomain"_s);
258 missingIdentifiers.append(u
"applicationName"_s);
260 if (!missingIdentifiers.isEmpty())
261 qmlWarning(
q) <<
"The following application identifiers have not been set: " << missingIdentifiers;
296 const int offset =
mo->propertyOffset();
297 const int count =
mo->propertyCount();
315 qCDebug(lcQmlSettings) <<
"QQmlSettings: load" <<
property.name() <<
"setting:" <<
currentValue <<
"default:" << previousValue;
325 static const int propertyChangedIndex =
mo->indexOfSlot(
"_q_propertyChanged()");
336 qCDebug(lcQmlSettings) <<
"QQmlSettings: store" <<
it.key() <<
":" <<
it.value();
346 const int offset =
mo->propertyOffset();
347 const int count =
mo->propertyCount();
352 qCDebug(lcQmlSettings) <<
"QQmlSettings: cache" <<
property.name() <<
":" <<
value;
363 if (
var.
metaType() == QMetaType::fromType<QJSValue>())
448 return d->instance()->value(
key, defaultValue);
463 qCDebug(lcQmlSettings) <<
"QQmlSettings: setValue" <<
key <<
":" <<
value;
482 d->instance()->sync();
499 if (
event->timerId() !=
d->timerId)
508#include "moc_qqmlsettings_p.cpp"
QString organizationName
the name of the organization that wrote this application
QString applicationName
the name of this application
QString organizationDomain
the Internet domain of the organization that wrote this application
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QJSValue class acts as a container for Qt/JavaScript data types.
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
void killTimer(int id)
Kills the timer with timer identifier, id.
static bool isLocalFile(const QString &url)
Returns true if url is a local file that can be opened with \l{QFile}.
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to \l{QFile}.
QPointer< QSettings > settings
QHash< const char *, QVariant > changedProperties
QVariant readProperty(const QMetaProperty &property) const
~QQmlSettingsPrivate()=default
void _q_propertyChanged()
QSettings * instance() const
void setLocation(const QUrl &location)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
Q_INVOKABLE void sync()
\qmlmethod Settings::sync()
Q_INVOKABLE void setValue(const QString &key, const QVariant &value)
\qmlmethod Settings::setValue(string key, var value)
void setCategory(const QString &category)
QQmlSettings(QObject *parent=nullptr)
void locationChanged(const QUrl &arg)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue={}) const
\qmlmethod var Settings::value(string key, var defaultValue)
void categoryChanged(const QString &arg)
QString fileName() const
Returns the path where settings written using this QSettings object are stored.
void setValue(QAnyStringView key, const QVariant &value)
Sets the value of setting key to value.
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
void beginGroup(QAnyStringView prefix)
Appends prefix to the current group.
Status status() const
Returns a status code indicating the first error that was met by QSettings, or QSettings::NoError if ...
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QMetaType metaType() const
static constexpr const int settingsWriteDelay
const QLoggingCategory & category()
[1]
QSet< QString >::iterator it
static QT_BEGIN_NAMESPACE const int settingsWriteDelay
\qmlmodule Qt.labs.settings 1.0 \title Qt Labs Settings QML Types
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
GLdouble GLdouble GLdouble GLdouble q
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, JSToQVariantConversionBehavior conversionBehavior, V4ObjectSet *visitedObjects)
QSettings settings("MySoft", "Star Runner")
[0]