[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Plasmoid plugin signal handling
From: Sebastian =?ISO-8859-1?Q?K=FCgler?= <sebas () kde ! org>
Date: 2017-06-13 14:49:26
Message-ID: 3249630.cyTibfVm9k () miro
[Download RAW message or body]
On dinsdag 13 juni 2017 16:27:47 CEST cdfghglz@gmail.com wrote:
[...]
> qmlRegisterType<DBusInterface>(uri, 1, 0, "ActivityJumper");
Why not call this class ActivityJumper in the first place, it's generally less
confusing to align class names with their QML names.
> ---------- ActivityJumper.qml
>
> Item {
> id: activityJumper
>
> property var activityJumperPlugin: null
> property bool activityJumperFailedToInitialize: false
>
> Connections {
> target: activityJumper
> onSignalDesktopChanged: console.log("got the signal")
> }
The signal isn't defined in "Item", you need to create a DBusObject object in
your QML code, then you can add a signal handler.
[...]
> ---------- main.qml
>
> Item {
> id: main
>
> ActivityJumper {
> id: activityJumper
Here, it'll be found:
onSignalDesktopChanged: print("desktop changed!")
Be careful, duplicate ids may lead to confusion (not a problem in separate
files, but better safe than sorry, better make it semantically correct in the
first place.
> With this I get the error: "QML Connections: Cannot assign to non-existent
> property "onSignalDesktopChanged"".
>
> Can you tell me what I am doin wrong or give me a hint what is the simplest
> way to catch a plugin signal in qml?
>
> Thanks a lot in advance!
Cheers,
--
sebas
http://www.kde.org | http://vizZzion.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic