Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Directory Listing with QML
Forum Updated to NodeBB v4.3 + New Features

Directory Listing with QML

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 6.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cnxsoft
    wrote on last edited by
    #1

    I'm trying to list the content of a directory (of picture files) and store it in an array in order to display the pictures in a slideshow using QML.

    I've tried to use ListView for that:

    @import QtQuick 1.0
    import Qt.labs.folderlistmodel 1.0

    Rectangle {
    ListView {
    width: 0; height: 0

         FolderListModel {
             id: folderModel
             folder: "file:///C:/QtProj/PigitalSignage/qml/PigitalSignage/video"
             nameFilters: ["*.*"]
         }
    
         Component {
             id: fileDelegate
             Text {
                 text: fileName
                 onTextChanged: {
                     console.debug("Filename:-" + fileName + "-")
                 }
             }
         }
         model: folderModel
         delegate: fileDelegate
    }
    

    }@

    But this is not ideal since it will only show files that are displayed in the window, I could give a large number of height but that does seem too good.

    I could also not find a way to create a (changeable) array with QML. I tried variant, but it seems read-only.

    Is there a way to do that with QML, or do I need to work something out in C++?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      As i understand you need a scrollable list view am i right?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cnxsoft
        wrote on last edited by
        #3

        Sorry for not being clear. I don't need to show the file list. I would just need to display each picture for X seconds.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          shifty
          wrote on last edited by
          #4

          This may be totally off-base but you could try something like this:

          @
          onCompleted: // start timer

          onTimerElapsed: // load another one, ie: change source
          @

          I haven't tried it, but it seems like a good idea, =D, hope this helps

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved