summaryrefslogtreecommitdiffstats
path: root/examples/declarative/loader/Browser.qml
blob: 640ea0c8df15b0b601c10c72373ee393716b93b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Rect {
    id: Root
    width: parent.width
    height: parent.height
    FolderListModel {
        id: folders
        nameFilters: [ "*.qml" ]
    }

    Component {
        id: FolderDelegate
        Text {
            id: Wrapper
            width: Root.width
            text: fileName
            font.bold: true
            font.size: 14
            MouseRegion {
                anchors.fill: parent
                onClicked: {
                    if (folders.isFolder(index)) {
                        folders.folder = filePath;
                    } else {
                        qmlLauncher.launch(filePath);
                    }
                }
            }
        }
    }

    Text { id: DirText; text: folders.folder }

    ListView {
        anchors.top: DirText.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        model: folders
        delegate: FolderDelegate
    }
}