import QtQuick 2.4
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
Window {
id: mainWindow
width: 600
height: 600
visible: true
ColumnLayout
{
width: parent ? parent.width : 200
Label
{
Layout.fillWidth: true
text: "<h2>MyApp</h2>"
horizontalAlignment: Text.AlignHCenter
}
RowLayout
{
Layout.fillWidth: true
Layout.fillHeight: true
Label
{
Layout.fillWidth: true
text: "Show hidden text"
}
Switch
{
id: someswitch
checked: false
}
}
Label
{
id: myText
text: "dummy"
wrapMode: Text.WordWrap
clip: true
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
states:
[
State
{
name: "invisible"
when: !someswitch.checked
PropertyChanges { target: myText; Layout.preferredHeight: 0 }
}
]
Behavior on Layout.preferredHeight
{
NumberAnimation { duration: 100 }
}
}
}
}