aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2/data/implicitsize.qml
blob: 756e230a873fe704d2c7e2518a94628846634c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import QtQuick 2.0

Item {
    implicitWidth: 200
    implicitHeight: 100

    width: 80
    height: 60

    function resetSize() {
        width = undefined
        height = undefined
    }

    function changeImplicit() {
        implicitWidth = 150
        implicitHeight = 80
    }

    function increaseImplicit() {
        implicitWidth = 200
        implicitHeight = 100
    }

    function assignImplicitBinding() {
        width = Qt.binding(function() { return implicitWidth < 175 ? implicitWidth : 175 })
        height = Qt.binding(function() { return implicitHeight < 90 ? implicitHeight : 90 })
    }

    function assignUndefinedBinding() {
        width = Qt.binding(function() { return implicitWidth < 175 ? undefined : 175 })
        height = Qt.binding(function() { return implicitHeight < 90 ? undefined : 90 })
    }
}