[Qt-qml] Applying common behaviour to a group of elements
Alex
alexlordax+qt at gmail.com
Thu Aug 5 02:33:33 CEST 2010
That works great, thanks!
Alex
On Wed, Aug 4, 2010 at 5:14 PM, <michael.brasser at nokia.com> wrote:
> On 05/08/2010, at 10:02 AM, ext Alex wrote:
>
>> C++ method:
>>
>> void Sequencer::addItem(QDeclarativeItem *item)
>> {
>> item->setOpacity(1);
>> }
>>
>>
>> Representative QML, not verbatim:
>>
>> Behavior on opacity {
>> NumberAnimation { to: 1; duration: 1000 }
>> }
>>
>> This correctly changes the opacity but fails to run the NumberAnimation.
>
> Behavior relies on being able to intercept changes to properties. Calling setOpacity directly in C++ bypasses the property system and thus Behaviors as well. If you changed the code to item->setProperty("opacity", 1); the Behavior should be correctly triggered.
>
> Regards,
> Michael
More information about the Qt-qml
mailing list