C

PropertyChanges QML Type

Describes new property bindings or values for a state. More...

Import Statement: import QtQuick .
Since: Qt Quick Ultralite 1.0

Properties

Detailed Description

PropertyChanges is used to define the property values or bindings in a State. This enables an item's property values to be changed when it changes between states.

To create a PropertyChanges object, specify the target item whose properties are to be modified, and define the new property values or bindings. For example:

import QtQuick 2.15

Item {
    id: container
    width: 300; height: 300

    Rectangle {
        id: rect
        width: 100; height: 100
        color: "red"

        MouseArea {
           id: mouseArea
           anchors.fill: parent
        }

    }
    states: State {
        name: "resized"; when: mouseArea.pressed
        PropertyChanges { target: rect; color: "blue"; height: container.height }
    }
}

When the mouse is pressed, the Rectangle changes to the resized state. In this state, the PropertyChanges object sets the rectangle's color to blue and the height value to that of container.height.

A PropertyChanges object can also override the default signal handler for an object to implement a signal handler specific to the new state:

PropertyChanges {
    target: myMouseArea
    onClicked: doSomethingDifferent()
}

Important: In Qt Quick Ultralite, PropertyChanges must not be used to change anchor margins; use AnchorChanges for this instead.

Property Documentation

target : Object

This property holds the object which contains the properties to be changed.


Available under certain Qt licenses.
Find out more.