some fixes to dragging behaviors
This commit is contained in:
parent
f74332d85d
commit
05c457be85
3 changed files with 29 additions and 13 deletions
|
@ -37,7 +37,7 @@ ColumnLayout {
|
||||||
id: serviceDropEnd
|
id: serviceDropEnd
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onDropped: {
|
onDropped: (drag) => {
|
||||||
print("DROPPED AT END");
|
print("DROPPED AT END");
|
||||||
appendItem(dragItemTitle,
|
appendItem(dragItemTitle,
|
||||||
dragItemType,
|
dragItemType,
|
||||||
|
@ -45,9 +45,21 @@ ColumnLayout {
|
||||||
dragItemBackgroundType,
|
dragItemBackgroundType,
|
||||||
dragItemText,
|
dragItemText,
|
||||||
dragItemIndex);
|
dragItemIndex);
|
||||||
|
dropHighlightLine.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
keys: ["library"]
|
keys: ["library"]
|
||||||
|
|
||||||
|
onEntered: (drag) => {
|
||||||
|
if (drag.keys[0] === "library") {
|
||||||
|
dropHighlightLine.visible = true;
|
||||||
|
var lastItem = serviceItemList.itemAtIndex(serviceItemModel.rowCount() - 1);
|
||||||
|
dropHighlightLine.y = lastItem.y + lastItem.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* onExited: dropHighlightLine.visible = false; */
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: serviceItemList
|
id: serviceItemList
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -89,14 +101,17 @@ ColumnLayout {
|
||||||
id: serviceDrop
|
id: serviceDrop
|
||||||
implicitWidth: serviceItemList.width
|
implicitWidth: serviceItemList.width
|
||||||
height: 50
|
height: 50
|
||||||
|
/* enabled: false */
|
||||||
|
|
||||||
onEntered: (drag) => {
|
onEntered: (drag) => {
|
||||||
if (drag.keys[0] === "library") {
|
if (drag.keys[0] === "library") {
|
||||||
indexedHLRec.visible = true;
|
dropHighlightLine.visible = true;
|
||||||
indexedHLRec.y = y - 2;
|
dropHighlightLine.y = y - 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* onExited: dropHighlightLine.visible = false; */
|
||||||
|
|
||||||
onDropped: (drag) => {
|
onDropped: (drag) => {
|
||||||
print("DROPPED IN ITEM AREA: " + drag.keys);
|
print("DROPPED IN ITEM AREA: " + drag.keys);
|
||||||
print(dragItemIndex + " " + index);
|
print(dragItemIndex + " " + index);
|
||||||
|
@ -114,7 +129,7 @@ ColumnLayout {
|
||||||
serviceItemList.moveToIndex);
|
serviceItemList.moveToIndex);
|
||||||
serviceItemList.currentIndex = moveToIndex;
|
serviceItemList.currentIndex = moveToIndex;
|
||||||
}
|
}
|
||||||
indexedHLRec.visible = false;
|
dropHighlightLine.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
keys: ["library","serviceitem"]
|
keys: ["library","serviceitem"]
|
||||||
|
@ -277,7 +292,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: indexedHLRec
|
id: dropHighlightLine
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 4
|
height: 4
|
||||||
color: Kirigami.Theme.hoverColor
|
color: Kirigami.Theme.hoverColor
|
||||||
|
@ -286,8 +301,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
Canvas {
|
Canvas {
|
||||||
/* asynchronous: true; */
|
/* asynchronous: true; */
|
||||||
x: indexedHLRec.width - 8
|
x: dropHighlightLine.width - 8
|
||||||
y: indexedHLRec.y - 17
|
y: dropHighlightLine.y - 17
|
||||||
z: 1
|
z: 1
|
||||||
width: 100; height: 100;
|
width: 100; height: 100;
|
||||||
contextType: "2d"
|
contextType: "2d"
|
||||||
|
@ -299,12 +314,12 @@ ColumnLayout {
|
||||||
ctx.path = tearDropPath;
|
ctx.path = tearDropPath;
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
visible: indexedHLRec.visible
|
visible: dropHighlightLine.visible
|
||||||
}
|
}
|
||||||
Path {
|
Path {
|
||||||
id: tearDropPath
|
id: tearDropPath
|
||||||
startX: indexedHLRec.width
|
startX: dropHighlightLine.width
|
||||||
startY: indexedHLRec.y + 4
|
startY: dropHighlightLine.y + 4
|
||||||
PathSvg {
|
PathSvg {
|
||||||
path: "M15 3
|
path: "M15 3
|
||||||
Q16.5 6.8 25 18
|
Q16.5 6.8 25 18
|
||||||
|
@ -374,7 +389,4 @@ ColumnLayout {
|
||||||
totalServiceItems++;
|
totalServiceItems++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeItem() {
|
|
||||||
serviceItemList.currentIndex = currentServiceItem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,12 +218,14 @@ Item {
|
||||||
dragItemType = "song";
|
dragItemType = "song";
|
||||||
dragItemBackgroundType = backgroundType;
|
dragItemBackgroundType = backgroundType;
|
||||||
dragItemBackground = background;
|
dragItemBackground = background;
|
||||||
|
draggedLibraryItem = self;
|
||||||
} else {
|
} else {
|
||||||
songListItem.Drag.drop()
|
songListItem.Drag.drop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filterChildren: true
|
filterChildren: true
|
||||||
threshold: 10
|
threshold: 10
|
||||||
|
/* onDropped: songDropped = true; */
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: songClickHandler
|
id: songClickHandler
|
||||||
|
|
|
@ -34,6 +34,8 @@ Controls.Page {
|
||||||
property var song
|
property var song
|
||||||
property var draggedLibraryItem
|
property var draggedLibraryItem
|
||||||
|
|
||||||
|
property bool songDragged: false
|
||||||
|
|
||||||
property string editType
|
property string editType
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue