[Qt-qml] Newbie questions
Alan Alpert
alan.alpert at nokia.com
Mon May 30 11:39:18 CEST 2011
On Mon, 30 May 2011 19:20:14 ext Thomas Ganshorn wrote:
> Hi
>
>
>
> I have a button that has multiple combining states.
> Basically like
> -> Enabled/Disabled
> -> On/Off
> -> Ok, Warning, Error, Inform State
>
> Now the button needs to display differently based on each combination of
> values.
>
> Eg. If ON the rectangle is filled, if off it isn't.
> If Ok, the color of the button is green, if warning it is yellow, red for
> error and blue for inform. Enabled buttons have rounded corners, disabled
> buttons have hard corners.
>
> So what i would to like would be assigning multiple states at once.
> What i don't like to do would be defining all conditions as states.
>
> I COULD do it without states by directly tying the values like enabled to
> eg. the color of an item. But i don't think it is the right way to do it.
> Or at least it would entangle look and functionalty and i thought that is
> the main reason for qml.
>
>
> So are there multiple states ? If not is this a planned feature ? And if
> not can it be added as a planned feature ?
>
You can have multiple non-exclusive state groups. By default, all states
inside one Item's states property are inside the same exclusive group. You can
create additional groups using the StateGroup element:
http://doc.qt.nokia.com/4.7-snapshot/qml-stategroup.html .
--
Alan Alpert
Senior Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list