How to set rootFolder in FolderListModel

  • In moving up directory i have this javascript:

    function dirUp() {
      if (parentFolder.toString() != "") {
        folder = parentFolder;

    I wanted to know what property to check to prevent it from moving up once it is currently in sanbox (ios).

    Based on the docs, setting the rootFolder prevents from moving up to parent directory, however i have problem setting the url. I tried setting the rootFolder with folder default value, but to no avail.

    Any advise?

  • @literA2


    Here is a simple example :

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Window 2.2
    import QtQuick.Layouts 1.3
    import Qt.labs.folderlistmodel 2.1
    Window {
        height: 300
        width: 500
        modality: Qt.ApplicationModal
        ColumnLayout {
            anchors.fill: parent
            ListView {
                width: 400; height: 200
                FolderListModel {
                    id: folderModel
                    showDirs: true
                    showFiles: false
                    //nameFilters: ["*.qml"]
                Component {
                    id: fileDelegate
                    Text { text: fileName }
                model: folderModel
                delegate: fileDelegate
            Button {
                text: qsTr("Parent")
                //Layout.fillWidth: parent
                onClicked: folderModel.folder = folderModel.parentFolder

  • @CharlieG Thanks for the reply, my FolderListModel is already working, I just want to restrict from moving up once in sanbox.

  • I resolved this issue by using folder instead of rootFolder.


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.