aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test8c.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/test8c.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/test8c.h.ref')
-rw-r--r--autotests/kconfig_compiler/test8c.h.ref22
1 files changed, 20 insertions, 2 deletions
diff --git a/autotests/kconfig_compiler/test8c.h.ref b/autotests/kconfig_compiler/test8c.h.ref
index 57469dca..7e96da0b 100644
--- a/autotests/kconfig_compiler/test8c.h.ref
+++ b/autotests/kconfig_compiler/test8c.h.ref
@@ -22,7 +22,7 @@ class Test8c : public KConfigSkeleton
static
void setFont( const QFont & v )
{
- if (!self()->isImmutable( QStringLiteral( "Font" ) ))
+ if (!self()->isFontImmutable())
self()->mFont = v;
}
@@ -36,12 +36,21 @@ class Test8c : public KConfigSkeleton
}
/**
+ Is Font Immutable
+ */
+ static
+ bool isFontImmutable()
+ {
+ return self()->isImmutable( QStringLiteral( "Font" ) );
+ }
+
+ /**
Set TitleFont
*/
static
void setTitleFont( const QFont & v )
{
- if (!self()->isImmutable( QStringLiteral( "TitleFont" ) ))
+ if (!self()->isTitleFontImmutable())
self()->mTitleFont = v;
}
@@ -54,6 +63,15 @@ class Test8c : public KConfigSkeleton
return self()->mTitleFont;
}
+ /**
+ Is TitleFont Immutable
+ */
+ static
+ bool isTitleFontImmutable()
+ {
+ return self()->isImmutable( QStringLiteral( "TitleFont" ) );
+ }
+
protected:
Test8c(KSharedConfig::Ptr config, QObject *parent = nullptr);
friend class Test8cHelper;