diff options
author | David Edmundson <kde@davidedmundson.co.uk> | 2020-08-27 12:52:48 +0100 |
---|---|---|
committer | David Edmundson <kde@davidedmundson.co.uk> | 2020-08-28 14:12:14 +0000 |
commit | 60f18e6c3c816f4bca7c72e5a4f114787309485a (patch) | |
tree | 7a9ec2de061793b348678835d56397f0f8669f7e /src/core/kcoreconfigskeleton.h | |
parent | 0f1b47f2ab4b374a6d85dcf9dd63e1159cc7ea65 (diff) | |
download | kconfig-60f18e6c3c816f4bca7c72e5a4f114787309485a.tar.gz kconfig-60f18e6c3c816f4bca7c72e5a4f114787309485a.tar.bz2 |
Introduce method to query KConfigSkeletonItem default value
5.64 added an isDefault method however this doesn't suffice for usage in
KConfigDialogManager which compares a current value to the default.
KConfigDialogManager currently uses a hack with side effects.
Exposing the value directly solves that.
Diffstat (limited to 'src/core/kcoreconfigskeleton.h')
-rw-r--r-- | src/core/kcoreconfigskeleton.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/kcoreconfigskeleton.h b/src/core/kcoreconfigskeleton.h index 9cf131b2..69f52060 100644 --- a/src/core/kcoreconfigskeleton.h +++ b/src/core/kcoreconfigskeleton.h @@ -230,6 +230,12 @@ public: */ bool isSaveNeeded() const; + /** + * Returns the default value + * @since 5.74 + */ + QVariant getDefault() const; + protected: explicit KConfigSkeletonItem(KConfigSkeletonItemPrivate &dd, const QString &_group, const QString &_key); @@ -247,6 +253,7 @@ protected: // KF6: Use proper pure virtuals in KConfigSkeletonItem void setIsDefaultImpl(const std::function<bool()> &impl); void setIsSaveNeededImpl(const std::function<bool()> &impl); + void setGetDefaultImpl(const std::function<QVariant()> &impl); KConfigSkeletonItemPrivate *const d_ptr; }; @@ -324,6 +331,8 @@ public: { setIsDefaultImpl([this] { return mReference == mDefault; }); setIsSaveNeededImpl([this] { return mReference != mLoadedValue; }); + setGetDefaultImpl([this] { return QVariant::fromValue(mDefault); }); + } /** |