View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#58
Hi kojacker,

I was sure that you had created a thread elsewhere asking about a QML file dialog, but I can't find it. Anyhow, I found this:

http://doc.qt.nokia.com/4.7-snapshot...listmodel.html

I've implemented it in the new QML version of cuteTube that I'm working on, and it works quite well.



Code:
ListView {
        id: fileList

        anchors { fill: dialog; leftMargin: 10; rightMargin: 10; topMargin: 80; bottomMargin: 10 }
        clip: true
        interactive: visibleArea.heightRatio < 1

        model: FolderListModel {
            id: folderModel

            nameFilters: [ "*.avi", "*.divx", "*.flv", "*.mp4", "*.mkv", "*.mpg", "*.wmv" ]
            showDotAndDotDot: true
            folder: "/home/stuart/"
        }

        delegate: FileChooserDelegate {
            id: delegate

            Connections {
                onDelegateClicked: {
                    fileList.currentIndex = index;
                    if (!folderModel.isFolder(index)) {
                        fileChosen(filepath); //signal
                        dialog.opacity = 0;
                        close(); //signal
                    }
                    else {
                        folderModel.folder = filepath;
                    }
                }
            }
        }
    }
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2011-03-05 at 23:27.
 

The Following User Says Thank You to marxian For This Useful Post: