From 08c0904a84fe94b1197443335018eda04a9d6378 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 1 Dec 2015 19:07:44 +0200 Subject: [PATCH] [app] Fixed the problem with the initial focus If the first press isn't ignored by the drag area then the first flick won't work. The problem has something to do with this drag area as everything works fine if the drag area is removed. Couldn't figure out what exactly the problem was and what's wrong with the initial focus, but this hack makes things work. --- app/qml/BooksDragArea.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/qml/BooksDragArea.qml b/app/qml/BooksDragArea.qml index 1d136a6..7f82af8 100644 --- a/app/qml/BooksDragArea.qml +++ b/app/qml/BooksDragArea.qml @@ -55,6 +55,7 @@ MouseArea { property bool dragCloseToTheRightEdge property real dragLastX property real dragLastY + property bool _ignorePress: true onDraggedItemIndexChanged: { draggedItem = (draggedItemIndex >= 0) ? shelf.get(draggedItemIndex) : null @@ -119,6 +120,14 @@ MouseArea { if (mouseY + gridView.contentY < 0) { // Let the header item handle it mouse.accepted = false + } else if (_ignorePress) { + // If the first press isn't ignored here then the first flick + // won't work. The problem has something to do with this drag + // area as everything works fine if the drag area is removed. + // Couldn't figure out what exactly the problem was and what's + // wrong with the initial focus, but this hack makes things work. + _ignorePress = false + mouse.accepted = false } } onReleased: {