binding - QML fade out changed item -


i'm new qt , qml - seems rather simple issue can't find simple solution it.

say have following example qml

item {     ... lots of other stuff      item {         id: obj_container          property var obj          text {             text: obj.name         }          image {             source: obj.source         }     } } 

now when obj property becomes null, fade out obj_container item, while still displaying values had before set null.

alternatively, if obj item changes different obj, fade out obj_container item (still displaying previous values) , fade in again new values.

how go this?

update

the obj in example q_property of object set using setcontextproperty c++, in

engine.rootcontext()->setcontextproperty("obj_holder", &obj_holder); 

the obj property in example above set like

obj_container.obj = obj_holder.obj 

though think purposes above doesn't make difference obj property coming or how set/changed. when obj changes, above should happen (fade out obj_container old values, fade in obj_container new values)

fading out can easy done 1 of animation.

for example:

import qtquick 2.4 import qtquick.window 2.2   window {     width: 600     height: 400     visible: true      text {         id: txt         anchors.centerin: parent         property int count: 0         text: count         opacity: 1         font.pixelsize: 100          sequentialanimation {              id: anim              propertyanimation {                  target: txt                  property: "opacity"                  to: 0                  duration: 1000                  easing.type: easing.outquart              }              propertyaction {                  target: txt                  property: "count"                  value: txt.count + 1              }              propertyanimation {                  target: txt                  property: "opacity"                  to: 1                  duration: 1000                  easing.type: easing.inoutcubic              }          }     }      timer {         interval: 2000         repeat: true         running: true         ontriggered: anim.running = true     } } 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

Python Error - TypeError: input expected at most 1 arguments, got 3 -

dns - How To Use Custom Nameserver On Free Cloudflare? -