StackView index (count of items)
Solved
QML and Qt Quick
-
wrote on 5 Jun 2020, 13:18 last edited by
Hello,
I have this simple code:
Window { visible: true width: 640;height: 480 StackView { id:stack anchors.fill: parent initialItem:Rectangle{ anchors.fill: parent color:"red" MouseArea{ anchors.fill: parent onClicked: { console.log(stack.index) } } } } }
But when I clicked on the rectangle, console output is :
qml: undefinedhow can I obtain count of items, or current index from StackView??
Thank you
-
Hello,
I have this simple code:
Window { visible: true width: 640;height: 480 StackView { id:stack anchors.fill: parent initialItem:Rectangle{ anchors.fill: parent color:"red" MouseArea{ anchors.fill: parent onClicked: { console.log(stack.index) } } } } }
But when I clicked on the rectangle, console output is :
qml: undefinedhow can I obtain count of items, or current index from StackView??
Thank you
-
wrote on 5 Jun 2020, 18:46 last edited by poucz 6 May 2020, 18:49
-
Thank you! Depth is what I want.
Can you please explain to me what is StackView.index - it is in the documentation?
What is it for and how is it used?
Thanks!!
wrote on 5 Jun 2020, 20:47 last edited by KroMignon 6 May 2020, 20:50@poucz said in StackView index (count of items):
What is it for and how is it used?
StackView.index
is an attached property, but it is only available in Quick.Controls 2.x, not Quick.Controls 1.x!initialItem:Rectangle{ anchors.fill: parent color:"red" MouseArea{ anchors.fill: parent onClicked: { console.log(StackView.index) } } }
==> see doc
1/4