I have one listView, on mouseArea after clicking on listview elements should append in Rectangle.but first elements appends but later saying that noting to push
QML debugging is enabled. Only use this in a safe environment.
qml: Layout
qml: Layout_send_id
qrc:/main.qml:62:9: QML StackView: push: nothing to push
Images for references
I want continue appending but it is replacing and show error as nothing to push
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Material 2.4
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick 2.4
import QtQuick.Controls 2.12
ApplicationWindow {
id:mainWindow
visible: true
width: 640
height: 480
title: qsTr("Scroll vertical horizontal")
Rectangle{
id:selectedItem
x:parent.width*0.2
y:parent.height*0.05
border.color: "black"
width: parent.width*0.3
height: parent.height*0.25
StackView{
id:layoutStack
}
}
StackLayout{
id:stackModel
}
Item{
id:element
Rectangle{
width: val*10
height: 20
border.color: "green"
Text {
id: input
}
}
}
ListModel{
id:listModel
ListElement{
name : "Layout"
}
ListElement{
name : "Layout_send_id"
}
ListElement{
name : "Layout_received_id"
}
}
property var val
ListView{
id:listView
x:parent.width*0.2
y:parent.height*0.35
model: listModel
width: 200
height: 250
delegate: Rectangle{
id:recta
width: parent.width
height: 20
border.color: "brown"
Text {
id: name
text: model.name
}
MouseArea{
id:clickArea
anchors.fill: parent
onClicked: {
val = (model.name).length
console.log(model.name)
input.text =model.name
layoutStack.push(element)
}
}
}
}
}