aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test8a.h.ref
diff options
context:
space:
mode:
authorMéven Car <meven.car@enioka.com>2020-02-04 16:03:52 +0100
committerMéven Car <meven29@gmail.com>2020-02-04 16:09:29 +0100
commitd46739294d04c72af1e434e414e1c012d7e78a42 (patch)
tree5a227069a6a1a110cc26b788ff8a3bd99005735e /autotests/kconfig_compiler/test8a.h.ref
parentfd0e26ddb49122fa55bdc8f35e189c832cc138ad (diff)
downloadkconfig-d46739294d04c72af1e434e414e1c012d7e78a42.tar.gz
kconfig-d46739294d04c72af1e434e414e1c012d7e78a42.tar.bz2
Add an is<PropertyName>Immutable to know if a property is immutable
Summary: Add a utility function is<Parameter>Immutable to access immutability quickly. Generated classes uses them internally to avoid code redundance. Sample: ``` /** Set blocked-by-default */ void setBlockedByDefault( bool v ) { if (v != mBlockedByDefault && !isBlockedByDefaultImmutable() ) { mBlockedByDefault = v; Q_EMIT blockedByDefaultChanged(); } } /** Is blocked-by-default Immutable */ bool isBlockedByDefaultImmutable() { return isImmutable( QStringLiteral( "blockedByDefault" ) ); } ``` ``` /** Set org.kde.ActivityManager.ResourceScoringEnabled */ void setResourceScoringEnabled( bool v ) { if (!isResourceScoringEnabledImmutable() ) mResourceScoringEnabled = v; } /** Is org.kde.ActivityManager.ResourceScoringEnabled Immutable */ bool isResourceScoringEnabledImmutable() { return isImmutable( QStringLiteral( "resourceScoringEnabled" ) ); } ``` Reviewers: ervin, #frameworks, dfaure Reviewed By: ervin Subscribers: dfaure, tcanabrava, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26368
Diffstat (limited to 'autotests/kconfig_compiler/test8a.h.ref')
-rw-r--r--autotests/kconfig_compiler/test8a.h.ref20
1 files changed, 18 insertions, 2 deletions
diff --git a/autotests/kconfig_compiler/test8a.h.ref b/autotests/kconfig_compiler/test8a.h.ref
index 3e890946..9e9c0f4e 100644
--- a/autotests/kconfig_compiler/test8a.h.ref
+++ b/autotests/kconfig_compiler/test8a.h.ref
@@ -20,7 +20,7 @@ class Test8a : public KConfigSkeleton
*/
void setFont( const QFont & v )
{
- if (!isImmutable( QStringLiteral( "Font" ) ))
+ if (!isFontImmutable())
mFont = v;
}
@@ -33,11 +33,19 @@ class Test8a : public KConfigSkeleton
}
/**
+ Is Font Immutable
+ */
+ bool isFontImmutable() const
+ {
+ return isImmutable( QStringLiteral( "Font" ) );
+ }
+
+ /**
Set TitleFont
*/
void setTitleFont( const QFont & v )
{
- if (!isImmutable( QStringLiteral( "TitleFont" ) ))
+ if (!isTitleFontImmutable())
mTitleFont = v;
}
@@ -49,6 +57,14 @@ class Test8a : public KConfigSkeleton
return mTitleFont;
}
+ /**
+ Is TitleFont Immutable
+ */
+ bool isTitleFontImmutable() const
+ {
+ return isImmutable( QStringLiteral( "TitleFont" ) );
+ }
+
protected:
// Group