Add support to enable fetching from QML
This commit is contained in:
		
					parent
					
						
							
								b88e8a6268
							
						
					
				
			
			
				commit
				
					
						6ee35b842c
					
				
			
		
					 1 changed files with 21 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
 *
 | 
			
		||||
 * Danbooru Client is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version version of the License, or
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * Danbooru Client is distributed in the hope that it will be useful,
 | 
			
		||||
| 
						 | 
				
			
			@ -27,8 +27,6 @@ import org.kde.kio 1.0
 | 
			
		|||
 | 
			
		||||
import DanbooruClient 1.0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Rectangle {
 | 
			
		||||
    id: rootObj
 | 
			
		||||
    width: 500
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +45,17 @@ Rectangle {
 | 
			
		|||
        nameFilters: [ "Image files (*.jpg *.png *.tiff *.gif)", "All files (*)" ]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Component {
 | 
			
		||||
        id: highlight
 | 
			
		||||
        Rectangle {
 | 
			
		||||
            width: grid.cellWidth; height: grid.cellHeight
 | 
			
		||||
            color: "lightsteelblue"; radius: 5
 | 
			
		||||
            x: grid.currentItem.x
 | 
			
		||||
            y: grid.currentItem.y
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Component {
 | 
			
		||||
        id: viewDelegate
 | 
			
		||||
        Item {
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +68,7 @@ Rectangle {
 | 
			
		|||
                id: postElement
 | 
			
		||||
                anchors.fill: parent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                QPixmapItem {
 | 
			
		||||
                    id: pixItem
 | 
			
		||||
                    pixmap: thumbPix
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +82,7 @@ Rectangle {
 | 
			
		|||
                    MouseArea {
 | 
			
		||||
                        id: mouseArea
 | 
			
		||||
                        anchors.fill: parent
 | 
			
		||||
 | 
			
		||||
                        hoverEnabled: true
 | 
			
		||||
                        onClicked: {
 | 
			
		||||
                            grid.currentIndex = index
 | 
			
		||||
| 
						 | 
				
			
			@ -164,11 +175,18 @@ Rectangle {
 | 
			
		|||
 | 
			
		||||
        flow: GridView.FlowLeftToRight
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
        highlight: highlight
 | 
			
		||||
        highlightFollowsCurrentItem: false
 | 
			
		||||
 | 
			
		||||
        model: danbooruModel
 | 
			
		||||
        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