Try to make the grid view with focus

This commit is contained in:
Luca Beltrame 2015-02-08 10:20:00 +01:00
parent 027bd6f6f5
commit 867f04daf8

View file

@ -38,8 +38,10 @@ Rectangle {
} }
signal downloadRequested(url url) signal downloadRequested(url url)
signal fileInfo(url name, var tags)
Component { Component {
// This is just for testing
id: highlight id: highlight
Rectangle { Rectangle {
width: grid.cellWidth; height: grid.cellHeight width: grid.cellWidth; height: grid.cellHeight
@ -62,6 +64,7 @@ Rectangle {
QPixmapItem { QPixmapItem {
id: pixItem id: pixItem
pixmap: thumbPix pixmap: thumbPix
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -78,6 +81,7 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
grid.currentIndex = index grid.currentIndex = index
rootObj.fileInfo(fileUrl, tags)
} }
onEntered: { onEntered: {
@ -152,7 +156,6 @@ Rectangle {
Text { Text {
id: sizeText id: sizeText
text: i18n("File size: %1", KCoreAddons.Format.formatByteSize(fileSize)) text: i18n("File size: %1", KCoreAddons.Format.formatByteSize(fileSize))
// anchors.horizontalCenter: parent.horizontalCenter
} }
Text { Text {
id: resolutionText id: resolutionText
@ -188,13 +191,17 @@ Rectangle {
flow: GridView.FlowLeftToRight flow: GridView.FlowLeftToRight
anchors.fill: parent anchors.fill: parent
highlight: highlight highlight: highlight
highlightFollowsCurrentItem: false highlightFollowsCurrentItem: true
highlightRangeMode: GridView.StrictlyEnforceRange
model: danbooruModel model: danbooruModel
delegate: viewDelegate delegate: viewDelegate
focus: true focus: true
Component.onCompleted: currentIndex = -1
Component.onCompleted: { currentIndex = 0}
onAtYEndChanged: { onAtYEndChanged: {
if (grid.atYEnd) { if (grid.atYEnd) {
danbooruService.getPostList(2, "", 10) danbooruService.getPostList(2, "", 10)