Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

How to make TableView Items draggable

$
0
0
I’ve a TableView and have implemented my own item delegate for it. I want to be able to drag it out and place it somewhere else. How do I do it itemDelegate: Text {                         id: objMainText                         anchors.horizontalCenter: parent.horizontalCenter                           elide: styleData.elideMode                         color: "yellow"                                                 text: styleData.value.get(0).content //assume this is correct                           MouseArea {                             id: objDragArea                               anchors.fill: parent                             drag.target: objDragableText                             drag.axis: Drag.XAndYAxis                               hoverEnabled: true                               onEntered: {                                 console.log("Hover Captured")          //This gets printed                             }                               onPressed: {                                 console.log("Detected")                     //This NEVER gets printed                             }                               Text {                                 id: objDragableText                                 anchors.verticalCenter: parent.verticalCenter                                 anchors.horizontalCenter: parent.horizontalCenter                                 Drag.active: objDragArea.drag.active                                 opacity: Drag.active / 2                                   text: objMainText.text                                 color: objMainText.color                                                                 states: State {                                     when: { objDragArea.drag.active }                                     AnchorChanges {                                         anchors.horizontalCenter: undefined                                         anchors.verticalCenter: undefined                                     }                                 }                             } Don’t mind if there are a few brackets less here and there. Those I’m taking care of ofcourse. But why can’t I drag objDragableText and how do i do it? Also, onClicked is captured as in the comments above but not onPressed. How do I also do this?

Viewing all articles
Browse latest Browse all 13965

Trending Articles