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

Attachment: signature.asc
Description: This is a digitally signed message part.

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

Reply via email to