D25149: Add a new template for KCMs

Kevin Ottens noreply at phabricator.kde.org
Wed Nov 13 21:59:41 GMT 2019


ervin requested changes to this revision.
ervin added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> %{APPNAMELC}settings.kcfgc:5
> +DefaultValueGetters=true
> +GenerateProperties=true

You also want "ParentInConstructor=true" in here.

> kcm.cpp:32
> +    : KQuickAddons::ConfigModule(parent, args)
> +    , m_settings(new %{APPNAME}Settings())
> +{

Pass this as parent here (currently you're leaking it)

> kcm.cpp:43
> +
> +    connect(m_settings, &%{APPNAME}Settings::configChanged, this, [this] { setNeedsSave(true); });
> +

Shouldn't be needed anymore (and likely wrong in most cases).

> kcm.h:26
> +
> +class %{APPNAME} : public KQuickAddons::ConfigModule
> +{

This should inherit from ManagedConfigModule now.

> kcm.h:36
> +
> +public Q_SLOTS:
> +    void load() override;

None of those slots are needed with a ManagedConfigModule (except if you need to do something outside the realm of the settings of course, which is not the case by default.

> main.qml:39
> +
> +        QQC2.TextField {
> +            text: kcm.settings.exampleSetting

What about disabling it if the setting is immutable?

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D25149

To: tcanabrava, #plasma, #frameworks, mart, ervin
Cc: #plasma, GB_2, yurchor, davidedmundson, ognarb, ervin, kde-frameworks-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, ragreen, michaelh, ZrenBot, ngraham, bruns, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191113/cbab5999/attachment.html>


More information about the Kde-frameworks-devel mailing list