This repository contains the source code used for a series of articles demonstrating how to implement reordering of a Qt Quick ListView via drag'n'drop.
agateau / listviewdragitem Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
This repository contains the source code used for a series of articles demonstrating how to implement reordering of a Qt Quick ListView via drag'n'drop.
Hi @agateau
Thanks for this elaborate example! I've been looking for something like this for a long time, and I do love a good cut'n'paste ;)
I've been trying to add a delay to the drag operation, as it is very often triggered when scrolling the ListView on a touch screen.
And it doesn't work. The dragArea is moved immediately, it just blocks the drop until timeout.
SilicaItem {
id: contentItemWrapper
anchors.fill: parent
//Drag.active: dragArea.drag.active
Drag.hotSpot {
x: contentItem.width / 2
y: contentItem.height / 2
}
property bool dragActive: dragArea.drag.active
property Timer dragDelay: Timer {
interval: 0
onTriggered: {
console.log("DraggableItem.dragDelay.start")
contentItemWrapper.Drag.active = dragArea.drag.active
}
}
onDragActiveChanged: {
dragDelay.start()
}
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
drag.axis: ListView.orientation === ListView.Horizontal ? Drag.XAxis : Drag.YAxis
drag.smoothed: false
onReleased: {
if (drag.active) {
emitMoveItemRequested();
}
}
}
}
Do you have an idea where to delay the drag?
Hi,
Thanks for sharing the DraggableItem. I have been playing around with it but there is one issue: the background is always white (unless I manually insert a rectangle with another color).
Do you have a hint what causes the white background?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.