joko
11th February 2015, 17:00
Hi Qt Masters,
I'm having problem displaying a rectangle when pressing and holding on selected delegate item.
Item {
id: listItem
anchors {
top: oparent.top
left: parent.left
right: parent.right
bottom: parent.bottom
}
ListView {
id: list
anchors.fill: parent
currentIndex: -1
clip: true
model: itemModel
delegate: ItemDelegate {
MouseArea {
id: area
anchors.fill: parent
onPressAndHold: {
menu.showed = true
menu.x = mouseX
menu.y = mouseY
}
}
}
boundsBehavior: Flickable.StopAtBounds
CustomMenu {
id: menu
z: 100
parent: list
model: menuModel
}
}
}
In the code above, it returns only the mouse coordinates on selected item that is why the menu always showed on top part of the Item.
When I tried putting mousearea on listItem, the ListView will not work.
Please advice, thanks.
I'm having problem displaying a rectangle when pressing and holding on selected delegate item.
Item {
id: listItem
anchors {
top: oparent.top
left: parent.left
right: parent.right
bottom: parent.bottom
}
ListView {
id: list
anchors.fill: parent
currentIndex: -1
clip: true
model: itemModel
delegate: ItemDelegate {
MouseArea {
id: area
anchors.fill: parent
onPressAndHold: {
menu.showed = true
menu.x = mouseX
menu.y = mouseY
}
}
}
boundsBehavior: Flickable.StopAtBounds
CustomMenu {
id: menu
z: 100
parent: list
model: menuModel
}
}
}
In the code above, it returns only the mouse coordinates on selected item that is why the menu always showed on top part of the Item.
When I tried putting mousearea on listItem, the ListView will not work.
Please advice, thanks.