Sailfish Pickers
API DocumentationMultiFilePickerDialog QML Type
A file picker for selecting multiple files More...
| Import Statement: | import Sailfish.Pickers 1.0 |
Properties
- nameFilters : list<string>
- selectedContent : ListModel
- title : string
Detailed Description
Here is an example usage that lists all pdf and doc files:
import QtQuick 2.2
import Sailfish.Silica 1.0
import Sailfish.Pickers 1.0
ApplicationWindow {
initialPage: Component {
Page {
id: page
property string selectedFiles
SilicaFlickable {
contentHeight: column.height + Theme.paddingLarge*2
anchors.fill: parent
VerticalScrollDecorator {}
Column {
id: column
width: parent.width
PageHeader {
title: "Multi file picker example"
}
ValueButton {
anchors.horizontalCenter: parent.horizontalCenter
label: "Upload documents"
value: selectedFiles ? selectedFiles : "None"
onClicked: pageStack.push(multiFilePickerDialog)
}
}
}
Component {
id: multiFilePickerDialog
MultiFilePickerDialog {
nameFilters: [ '*.pdf', '*.doc' ]
onAccepted: {
selectedFiles = ""
var urls = []
for (var i = 0; i < selectedContent.count; ++i) {
var url = selectedContent.get(i).url
// Handle url upload
urls.push(selectedContent.get(i).url)
}
selectedFiles = urls.join(", ")
}
onRejected: selectedFiles = ""
}
}
}
}
}Use FilePickerPage to select a single file.
See also MultiContentPickerDialog, MultiDocumentPickerDialog, MultiDownloadPickerDialog, MultiImagePickerDialog, MultiMusicPickerDialog, and MultiVideoPickerDialog.
Property Documentation
This property holds the name filters to limit the files shown by the picker.
This property holds the selected content item.
The selectedContentProperties value contains following members.
- fileName - file name without path
- filePath - full file path including file name
- url - filePath formatted as url
- title - name of the file, this can be fetched from metadata of the file
- mimeType - mime type of the file for example "image/jpeg", "image/png", "application/pdf", "video/mp4", "audio/mpeg"
This property holds the title of the dialog.
Defaults to translated "Select location".