import QtQuick 2.0 Rectangle { width: 400 height: 200 Rectangle { width: parent.width/2 height: parent.height color: "red" TextEdit { anchors.fill: parent text: "Aligned TextEdit" verticalAlignment: TextEdit.AlignVCenter horizontalAlignment: TextEdit.AlignHCenter } MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { if (mouse.button == Qt.LeftButton) parent.height -= 5 else parent.width -= 5 } } } Rectangle { anchors.right: parent.right width: parent.width/2 height: parent.height color: "lightgreen" Text { anchors.fill: parent text: "Aligned Text" verticalAlignment: TextEdit.AlignVCenter horizontalAlignment: TextEdit.AlignHCenter } MouseArea { id: mousearea anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { if (mouse.button == Qt.LeftButton) parent.height -= 5 else parent.width -= 5 } } } }