From 2284de02ec9557b23ff03d4ecf992fd8f5c00353 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 15 Dec 2014 11:44:10 +0100 Subject: [PATCH] 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 --- src/plugins/qmlprofiler/qml/CategoryLabel.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml index 367c2c8730a..07ba011b639 100644 --- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml +++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml @@ -100,13 +100,13 @@ Item { onPositionChanged: { var sourceIndex = drag.source.visualIndex; - if (drag.source.y + drag.source.height > dragOffset + labelContainer.height && - sourceIndex !== visualIndex && sourceIndex !== visualIndex + 1) { - var moveTo = sourceIndex > visualIndex ? visualIndex + 1 : visualIndex; - labelContainer.dropped(sourceIndex, moveTo); - } else if (drag.source.y === 0) { - // special case for first position. - labelContainer.dropped(sourceIndex, 0); + if (drag.source.y === 0) { + // special case for first position: Always swap, no matter if upper border touched. + if (sourceIndex > visualIndex) + labelContainer.dropped(sourceIndex, visualIndex); + } else if (sourceIndex !== visualIndex && sourceIndex !== visualIndex + 1) { + labelContainer.dropped(sourceIndex, sourceIndex > visualIndex ? visualIndex + 1 : + visualIndex); } }