aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextedit/data/resizeTextEditPolish.qml
blob: 44819a0de978a17a7f250e4d2de051689d4f09f8 (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
35
36
37
38
39
40
41
42
import QtQuick
import QtQuick.Controls

Item {
    width: 400
    height: 150

    TextEdit {
        id: textEdit
        anchors {
            top: parent.top
            left: parent.left
            right: parent.right
        }
        readOnly: true
        wrapMode: Text.WordWrap
        verticalAlignment: Text.AlignVCenter
        text: "Lorem ipsum dolor sit amet, consectetur adipisicing"
        states: [
            State {
                name: "multi-line"
                when: textEdit.lineCount > 1
                AnchorChanges {
                    target: textEdit
                    anchors.bottom: undefined
                }
                PropertyChanges {
                    target: textEdit
                    height: undefined
                }
            },
            State {
                name: "single-line"
                when: true
                AnchorChanges {
                    target: textEdit
                    anchors.bottom: { return textEdit.parent.bottom }
                }
            }
        ]
    }
}