[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Behaviours with States
From:       "=?utf-8?q?Micha=C5=82_=27rysiek=27?= =?utf-8?q?_Wo=C5=BAniak?=" <rysiek () fwioo ! p
Date:       2013-04-17 21:51:47
Message-ID: 201304172351.49807.rysiek () fwioo ! pl
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hi there,

In my QML plasmoid I was tracking a bug related to using Behaviours 
with States, when I found this helpful documentation page:
http://qt-project.org/doc/qt-4.8/qml-behaviors-and-states.html

This solved it for me, or rather nudged me in the right direction. I 
have found another way of solving this problem - just explicitly 
define the default state:

states: [
         State {
             name: "GreenState"
             when: mouser.containsMouse

             PropertyChanges {
                 target: coloredRect
                 color: "green"
             }
         },
         State {
             name: ""

             PropertyChanges {
                 target: coloredRect
                 color: "red"
             }
         }
]

This does not require the rest of the QML app to be aware of the name 
of the new "default" state; nor does it require the default state 
conditions to be precisely defined (which sometimes might be a 
challenge, and besides opens the plasmoid for new, hard to track 
errors).

The empty name "" denotes the default base state anyway.

I have tested it in my plasmoid and it indeed works. I think it would 
be a good idea to out that in the docs.

-- 
Pozdrawiam
Michał "rysiek" Woźniak

Fundacja Wolnego i Otwartego Oprogramowania

["signature.asc" (application/pgp-signature)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic