I am trying to create a simple GUI with QML, when the following occured:
Text items can be aligned using anchors under the ApplicationWindow
Copying the same code snipped (i just changed the id’s) inside a Tab results in an error: ReferenceError: textC is not defined. This results in textC being placed on top of textB (see also picture)
QML Code:
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
ApplicationWindow {
id: applicationWindow1
visible: true
width: 640
height: 480
title: qsTr("MyApp")
Text{
id: textA
text: qsTr("Test A")
}
Text{
id: textB
text: qsTr("Test B")
anchors.left: textA.right //aligns textB nicely against textA
}
TabView{
anchors.top: textB.bottom //also alignts TabView nicely against textB
Tab{
title: qsTr("TEST")
Text{
id: textC
text: qsTr("Test C")
}
Text{
id: textD
text: qsTr("Test D")
anchors.left: textC.right //nope... this doesn't work even though
//textC lives under the same parent
}
}
}
}
Picture: http://s2.postimg.org/hzvyntxfd/info.png
As far as i know the anchors should work because textC and textD live under the same parent.
Am i missing something or is this just not allowed in QML?
Thanks in advance!