From 867f04daf8b1dcabc0137e0175c821aeb6af20f4 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sun, 8 Feb 2015 10:20:00 +0100 Subject: [PATCH] Try to make the grid view with focus --- src/qml/danbooruimageview.qml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/qml/danbooruimageview.qml b/src/qml/danbooruimageview.qml index 45993e8..02ca708 100644 --- a/src/qml/danbooruimageview.qml +++ b/src/qml/danbooruimageview.qml @@ -38,8 +38,10 @@ Rectangle { } signal downloadRequested(url url) + signal fileInfo(url name, var tags) Component { + // This is just for testing id: highlight Rectangle { width: grid.cellWidth; height: grid.cellHeight @@ -62,6 +64,7 @@ Rectangle { QPixmapItem { + id: pixItem pixmap: thumbPix anchors.horizontalCenter: parent.horizontalCenter @@ -78,6 +81,7 @@ Rectangle { hoverEnabled: true onClicked: { grid.currentIndex = index + rootObj.fileInfo(fileUrl, tags) } onEntered: { @@ -152,7 +156,6 @@ Rectangle { Text { id: sizeText text: i18n("File size: %1", KCoreAddons.Format.formatByteSize(fileSize)) -// anchors.horizontalCenter: parent.horizontalCenter } Text { id: resolutionText @@ -188,13 +191,17 @@ Rectangle { flow: GridView.FlowLeftToRight anchors.fill: parent + highlight: highlight - highlightFollowsCurrentItem: false + highlightFollowsCurrentItem: true + highlightRangeMode: GridView.StrictlyEnforceRange model: danbooruModel delegate: viewDelegate focus: true - Component.onCompleted: currentIndex = -1 + + Component.onCompleted: { currentIndex = 0} + onAtYEndChanged: { if (grid.atYEnd) { danbooruService.getPostList(2, "", 10) @@ -209,4 +216,4 @@ Rectangle { } -} \ No newline at end of file +}