aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/settings/qqmlsettings.cpp19
-rw-r--r--src/imports/settings/qqmlsettings_p.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index f7a7d8b055..287a70363a 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -487,6 +487,25 @@ void QQmlSettings::setValue(const QString &key, const QVariant &value)
qCDebug(lcSettings) << "QQmlSettings: setValue" << key << ":" << value;
}
+/*!
+ \qmlmethod Settings::sync()
+
+ Writes any unsaved changes to permanent storage, and reloads any
+ settings that have been changed in the meantime by another
+ application.
+
+ This function is called automatically from QSettings's destructor and
+ by the event loop at regular intervals, so you normally don't need to
+ call it yourself.
+
+ \sa QSettings::sync
+*/
+void QQmlSettings::sync()
+{
+ Q_D(QQmlSettings);
+ d->instance()->sync();
+}
+
void QQmlSettings::classBegin()
{
}
diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h
index f9122a58f7..a86c8b4751 100644
--- a/src/imports/settings/qqmlsettings_p.h
+++ b/src/imports/settings/qqmlsettings_p.h
@@ -79,6 +79,7 @@ public:
Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
Q_INVOKABLE void setValue(const QString &key, const QVariant &value);
+ Q_INVOKABLE void sync();
protected:
void timerEvent(QTimerEvent *event) override;