Quantcast
Channel: Active questions tagged qtquick2 - Stack Overflow
Viewing all articles
Browse latest Browse all 107

QML how to make Behavior working on multiple properties

$
0
0

Is there any way to make Behavior work on multiple attributes simultaneously to simplify the code?

ApplicationWindow {    width: 1280    height: 720    visible: true    title: qsTr("Hello World")    color:"#202020"    Rectangle{        id:rect        x:100        y:100        width: 100        height: 50        color:"red"        Behavior on x, y, width, height, color{ //there will be error here            PropertyAnimation{duration:1000}        }    }    Button{        onClicked: {            rect.x=300            rect.y=400            rect.width=200            rect.height100            rect.color="green"        }    }}

I want all 5 attributes to have a smooth change effect, so I have to define 5 Behaviors and apply them to each of these 5 properties separately, I think this is troublesome.


Viewing all articles
Browse latest Browse all 107

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>