Adjust QML view
Add transitions on button showing / hiding Add a ScrollView to make scollbars appear Formatting fixes for readability
This commit is contained in:
parent
6ee35b842c
commit
95554b1aac
1 changed files with 51 additions and 36 deletions
|
@ -32,19 +32,13 @@ Rectangle {
|
||||||
width: 500
|
width: 500
|
||||||
height: 500
|
height: 500
|
||||||
|
|
||||||
|
|
||||||
KRun {
|
KRun {
|
||||||
id: runner
|
id: runner
|
||||||
}
|
}
|
||||||
|
|
||||||
signal downloadRequested(url url)
|
signal downloadRequested(url url)
|
||||||
|
|
||||||
FileDialog {
|
|
||||||
id: saveFileDialog
|
|
||||||
title: "Select a file to save to"
|
|
||||||
selectExisting: false
|
|
||||||
nameFilters: [ "Image files (*.jpg *.png *.tiff *.gif)", "All files (*)" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: highlight
|
id: highlight
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -55,7 +49,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: viewDelegate
|
id: viewDelegate
|
||||||
Item {
|
Item {
|
||||||
|
@ -63,12 +56,10 @@ Rectangle {
|
||||||
width: grid.cellWidth
|
width: grid.cellWidth
|
||||||
height: grid.cellHeight
|
height: grid.cellHeight
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: postElement
|
id: postElement
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
||||||
QPixmapItem {
|
QPixmapItem {
|
||||||
id: pixItem
|
id: pixItem
|
||||||
pixmap: thumbPix
|
pixmap: thumbPix
|
||||||
|
@ -90,54 +81,73 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
viewButton.visible = mouseArea.containsMouse ? true: false
|
|
||||||
downloadButton.visible = mouseArea.containsMouse ? true: false
|
viewButton.visible = true
|
||||||
|
downloadButton.visible = true
|
||||||
|
viewButton.opacity = 1
|
||||||
|
downloadButton.opacity = 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
viewButton.visible = mouseArea.containsMouse ? true: false
|
viewButton.opacity = 0
|
||||||
downloadButton.visible = mouseArea.containsMouse ? true: false
|
downloadButton.opacity = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: viewButton
|
id: viewButton
|
||||||
iconName: "view-preview"
|
iconName: "view-preview"
|
||||||
visible: false
|
visible: false
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.topMargin: (pixItem.height - pixItem.paintedHeight) / 2
|
anchors.topMargin: (pixItem.height - pixItem.paintedHeight) / 2
|
||||||
anchors.leftMargin: (pixItem.width - pixItem.paintedWidth) / 2
|
anchors.leftMargin: (pixItem.width - pixItem.paintedWidth) / 2
|
||||||
|
|
||||||
height: pixItem.height * 0.15
|
height: pixItem.height * 0.15
|
||||||
width: pixItem.height * 0.15
|
width: pixItem.height * 0.15
|
||||||
z: 1
|
z: 1
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
runner.openUrl(fileUrl)
|
runner.openUrl(fileUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
id: downloadButton
|
id: downloadButton
|
||||||
iconName: "download"
|
iconName: "download"
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottomMargin: (pixItem.height - pixItem.paintedHeight) / 2
|
anchors.bottomMargin: (pixItem.height - pixItem.paintedHeight) / 2
|
||||||
anchors.leftMargin: (pixItem.width - pixItem.paintedWidth) / 2
|
anchors.leftMargin: (pixItem.width - pixItem.paintedWidth) / 2
|
||||||
|
|
||||||
height: pixItem.height * 0.15
|
height: pixItem.height * 0.15
|
||||||
width: pixItem.height * 0.15
|
width: pixItem.height * 0.15
|
||||||
z: 1
|
z: 1
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("AA" + pixItem.paintedHeight)
|
|
||||||
rootObj.downloadRequested(fileUrl)
|
rootObj.downloadRequested(fileUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: sizeText
|
id: sizeText
|
||||||
|
@ -168,26 +178,31 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridView {
|
ScrollView {
|
||||||
id: grid
|
id: scrollView
|
||||||
cellWidth: 230
|
|
||||||
cellHeight: 230
|
|
||||||
|
|
||||||
flow: GridView.FlowLeftToRight
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
highlight: highlight
|
GridView {
|
||||||
highlightFollowsCurrentItem: false
|
id: grid
|
||||||
|
cellWidth: 230
|
||||||
|
cellHeight: 230
|
||||||
|
|
||||||
model: danbooruModel
|
flow: GridView.FlowLeftToRight
|
||||||
delegate: viewDelegate
|
anchors.fill: parent
|
||||||
focus: true
|
highlight: highlight
|
||||||
Component.onCompleted: currentIndex = -1
|
highlightFollowsCurrentItem: false
|
||||||
onAtYEndChanged: {
|
|
||||||
if (grid.atYEnd) {
|
model: danbooruModel
|
||||||
// danbooruService.getPostList(2, "", 10)
|
delegate: viewDelegate
|
||||||
|
focus: true
|
||||||
|
Component.onCompleted: currentIndex = -1
|
||||||
|
onAtYEndChanged: {
|
||||||
|
if (grid.atYEnd) {
|
||||||
|
// danbooruService.getPostList(2, "", 10)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue