Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.47 KB | None | 0 0
  1.  
  2. // This does not work, page.model.count is 11 (so it's not empty) and printing filePath for each Image works as intended, it displays the file path of the image I want to display, however no image is shown.
  3. import QtQuick 2.0
  4. import Sailfish.Silica 1.0
  5. import Sailfish.Pickers 1.0
  6. import Qt.labs.folderlistmodel 2.1
  7.  
  8. Page {
  9.     id: page
  10.     allowedOrientations: Orientation.All
  11.     property FolderListModel model
  12.  
  13.     SilicaFlickable {
  14.         id: flickable
  15.         anchors.fill: parent
  16.         clip: true
  17.  
  18.         SlideshowView {
  19.             id: imageContainer
  20.             clip: true
  21.             width: flickable.width
  22.             height: flickable.height
  23.             model: page.model
  24.             delegate: Image {
  25.                 id: theImage
  26.                 source: filePath
  27.                 fillMode: Image.PreserveAspectFit
  28.                 width: imageContainer.width
  29.                 cache: false
  30.                 clip: true
  31.                 asynchronous: true
  32.             }
  33.         }
  34.         PullDownMenu {
  35.             MenuItem {
  36.                 text: "Open Folder"
  37.                 onClicked: pageStack.push(Qt.resolvedUrl("FileChooser.qml"), {folder: "/home/nemo"})
  38.             }
  39.         }
  40.         ScrollDecorator{}
  41.     }
  42. }
  43.  
  44. //----------------------------------------------------------------------
  45.  
  46. // This works it displays 5 images in the SlideshowView, too bad they are all the same image :(
  47.  
  48. import QtQuick 2.0
  49. import Sailfish.Silica 1.0
  50. import Sailfish.Pickers 1.0
  51. import Qt.labs.folderlistmodel 2.1
  52.  
  53. Page {
  54.     id: page
  55.     allowedOrientations: Orientation.All
  56.     property FolderListModel model
  57.  
  58.     SilicaFlickable {
  59.         id: flickable
  60.         anchors.fill: parent
  61.         clip: true
  62.  
  63.         SlideshowView {
  64.             id: imageContainer
  65.             clip: true
  66.             width: flickable.width
  67.             height: flickable.height
  68.             model: 5
  69.             delegate: Image {
  70.                 id: theImage
  71.                 source: "/home/nemo/whatever_image.jpg"
  72.                 fillMode: Image.PreserveAspectFit
  73.                 width: imageContainer.width
  74.                 cache: false
  75.                 clip: true
  76.                 asynchronous: true
  77.             }
  78.         }
  79.         PullDownMenu {
  80.             MenuItem {
  81.                 text: "Open Folder"
  82.                 onClicked: pageStack.push(Qt.resolvedUrl("FileChooser.qml"), {folder: "/home/nemo"})
  83.             }
  84.         }
  85.         ScrollDecorator{}
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement