Settings for pure QML applet

David Edmundson david at davidedmundson.co.uk
Wed May 1 10:30:37 UTC 2013


On Wed, May 1, 2013 at 10:45 AM, Jan Grulich <jgrulich at redhat.com> wrote:
> Dne 1.5.2013 11:11, Sebastian Kügler napsal(a):
>
>> Hi Jan,
>>
>> On Wednesday, May 01, 2013 04:58:28 Jan Grulich wrote:
>>>
>>> is there any other option how to add settings for pure QML applet? I've
>>> found only KConfigXT where I can't use custom widgets or I can load
>>> KCModule to applet settings but this configuration is not saved in
>>> plasma-desktop-appletsrc file and then I can't use plasmoid.readEntry()
>>> in
>>> QML.
>>
>> KConfigXt (and what you describe) is the only way to do it in Plasma1.
>>
>> In Plasma2, you can add a config.qml, which holds the configuration.
>>
>> If you want to prepare for Plasma2, you can do the configuration in QML,
>> and
>> add a button to open it, for example in a PlasmaComponents.Dialog, or
>> you'll
>> have to do a C++ appplet.
>>
>>
> Maybe something like this may solve my problem. I can create custom C++
> widget and expand it to QML and then open it in PlasmaComponents.Dialog. The
> second thing I need is saving QStringList via plasmoid.writeEntry() in QML
> and I don't know if this is possible. I know that it's possible in C++ but
> in QML I have to pass it through variant. Do you think that it's possible?
> Thanks
>>

Another possible solution is to create a new QWidget in C++ that has a
Q_PROPERTY with "USER true" so that it can be read in/out with
KConfigXT. Add this via QDesignerCustomWidgetInterface so that it can
be created by QUILoader. Then add your custom widget to your plasma
config .ui file as a promoted widget.

I do a that technique here where I'm using the Plasma::Config like the
applets do: https://projects.kde.org/projects/playground/base/lightdm/repository/revisions/master/show/kcm/configwidgets


More information about the Plasma-devel mailing list