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 { 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 {
    myMouseArea.onClicked: doSomethingDifferent()
}

Note: : PropertyChanges can be used to change anchor margins, but not other anchor values; use AnchorChanges for this instead.

Property Documentation

target : Object

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

Note: You generally don't have to use this property. It only exists for compatibility with older versions and for compatibility with Qt Design Studio.


Available under certain Qt licenses.
Find out more.