Commit dfa1449f authored by Alberto Mardegan's avatar Alberto Mardegan

Desktop,TagCloud: use a single MouseArea

There's no need for each item to have its own.
parent b6a43ab5
Pipeline #47864650 (#473) passed with stages
in 21 minutes and 44 seconds
......@@ -14,7 +14,7 @@ Item {
implicitHeight: flow.childrenRect.height
Item {
MouseArea {
id: flow
property int rowSpacing: 2
......@@ -24,6 +24,16 @@ Item {
anchors.fill: parent
onWidthChanged: reflowTimer.start()
visible: false
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
var item = childAt(mouse.x, mouse.y)
console.log("Item is " + item)
if (!item) return
root.selectedTags = [ item.tag ]
if (mouse.button == Qt.RightButton) {
root.contextMenuRequested(mouse)
}
}
Repeater {
id: repeater
......@@ -44,17 +54,6 @@ Item {
elide: Text.ElideMiddle
color: selected ? palette.highlightedText : palette.text
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
root.selectedTags = [ model.tag ]
if (mouse.button == Qt.RightButton) {
root.contextMenuRequested(mouse)
}
}
}
}
onItemAdded: reflowTimer.start()
onItemRemoved: reflowTimer.start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment