Sailfish Pickers
API DocumentationMultiContentPickerDialog QML Type
A multi-content picker that groups all the supported picker types under one dialog More...
| Import Statement: | import Sailfish.Pickers 1.0 |
Properties
- acceptText : string
- selectedContent : ListModel
- title : string
Detailed Description
The MultiContentPickerDialog type is a picker dialog that can be used to select multiple files from the content types listed below:
- Documents - document files in /home/<user>/
- Images - image files in /home/<user>/ excluding standard music directory (/home/<user>/Music)
- Videos - video files in /home/<user>/
- Music - music files in /home/<user>/
Here is an example usage:
import QtQuick 2.2
import Sailfish.Silica 1.0
import Sailfish.Pickers 1.0
ApplicationWindow {
initialPage: Component {
Page {
property string selectedFiles
SilicaFlickable {
contentHeight: column.height + Theme.paddingLarge*2
anchors.fill: parent
VerticalScrollDecorator {}
Column {
id: column
width: parent.width
PageHeader {
title: "Multi content picker example"
}
ValueButton {
anchors.horizontalCenter: parent.horizontalCenter
label: "Upload files"
value: selectedFiles ? selectedFiles : "None"
onClicked: pageStack.push(multiDocumentPickerDialog)
}
}
}
Component {
id: multiDocumentPickerDialog
MultiDocumentPickerDialog {
title: "Select files"
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 ContentPickerPage to select a single file.
See also MultiDocumentPickerDialog, MultiDownloadPickerDialog, MultiImagePickerDialog, MultiMusicPickerDialog, MultiVideoPickerDialog, and ContentPickerPage.
Property Documentation
This property holds the selected content items.
ListModel contains following roles:
- 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", "application/pdf", "video/mp4", "audio/mpeg"