forked from qt-creator/qt-creator
QmlProfiler: Fix drag/drop reordering
Since the reorganization into rows it would behave strangely when reordering small categories under large ones. Change-Id: Ic481710a706cc06a699e50ff60eaea2937a50530 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -100,13 +100,13 @@ Item {
|
|||||||
|
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
var sourceIndex = drag.source.visualIndex;
|
var sourceIndex = drag.source.visualIndex;
|
||||||
if (drag.source.y + drag.source.height > dragOffset + labelContainer.height &&
|
if (drag.source.y === 0) {
|
||||||
sourceIndex !== visualIndex && sourceIndex !== visualIndex + 1) {
|
// special case for first position: Always swap, no matter if upper border touched.
|
||||||
var moveTo = sourceIndex > visualIndex ? visualIndex + 1 : visualIndex;
|
if (sourceIndex > visualIndex)
|
||||||
labelContainer.dropped(sourceIndex, moveTo);
|
labelContainer.dropped(sourceIndex, visualIndex);
|
||||||
} else if (drag.source.y === 0) {
|
} else if (sourceIndex !== visualIndex && sourceIndex !== visualIndex + 1) {
|
||||||
// special case for first position.
|
labelContainer.dropped(sourceIndex, sourceIndex > visualIndex ? visualIndex + 1 :
|
||||||
labelContainer.dropped(sourceIndex, 0);
|
visualIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user