Skip to content

Instantly share code, notes, and snippets.

@anta40
Created January 17, 2013 16:51
Show Gist options
  • Save anta40/4557461 to your computer and use it in GitHub Desktop.
Save anta40/4557461 to your computer and use it in GitHub Desktop.
bingung
import bb.cascades 1.0
import bb.cascades.pickers 1.0
NavigationPane {
id: navigationPane
Page {
titleBar: TitleBar {
title: qsTr ("ExiView")
}
Container {
layout: DockLayout {}
// The background image
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
topPadding: 50
leftPadding: 30
rightPadding: 30
// The file picker view mode selector
DropDown {
id: pickerViewMode
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("View Mode")
Option {
text: qsTr ("Default")
value: FilePickerViewMode.Default
selected: true
}
Option {
text: qsTr ("List View")
value: FilePickerViewMode.ListView
}
Option {
text: qsTr ("Grid View")
value: FilePickerViewMode.GridView
}
}
// The file picker sort criterion selector
DropDown {
id: pickerSortBy
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("Sort by")
Option {
text: qsTr ("Default")
value: FilePickerSortFlag.Default
selected: true
}
Option {
text: qsTr ("Name")
value: FilePickerSortFlag.Name
}
Option {
text: qsTr ("Date")
value: FilePickerSortFlag.Date
}
Option {
text: qsTr ("Suffix")
value: FilePickerSortFlag.Suffix
}
Option {
text: qsTr ("Size")
value: FilePickerSortFlag.Size
}
}
// The file picker sort order selector
DropDown {
id: pickerSortOrder
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("Sort order")
Option {
text: qsTr ("Default")
value: FilePickerSortOrder.Default
selected: true
}
Option {
text: qsTr ("Ascending")
value: FilePickerSortOrder.Ascending
}
Option {
text: qsTr ("Descending")
value: FilePickerSortOrder.Descending
}
}
//! [1]
// The 'Show' button
Button {
horizontalAlignment: HorizontalAlignment.Center
topMargin: 100
text: qsTr ("Search")
onClicked: picker.open()
}
//! [1]
//! [2]
// The result label
Label {
id: resultLabel
horizontalAlignment: HorizontalAlignment.Center
topMargin: 30
text: qsTr ("Selected file: %1").arg(picker.selectedFile)
textStyle {
base: SystemDefaults.TextStyles.BodyText
color: Color.White
}
multiline: true
visible: (picker.selectedFile != "")
}
//! [2]
}
}
attachedObjects: [
FilePicker {
id: picker
property string selectedFile
title: qsTr ("Search for file")
mode: FilePicker.Picker
type: FilePicker.Picture
viewMode: pickerViewMode.selectedValue
sortBy: pickerSortBy.selectedValue
sortOrder: pickerSortOrder.selectedValue
onFileSelected: {
//selectedFile = selectedFiles[0]
navigationPane.push(firstPage)
}
}
]}
attachedObjects: [
Page {
id: firstPage
titleBar: TitleBar {
title: qsTr ("Tag Viewer")
}
content: Container {
Label {
text: "First attachedObjects Page"
}
ImageView {
id : theimage
scalingMethod: ScalingMethod.AspectFit
}
}
},
Page {
id: secondPage
content: Container {
Label {
text: "Second attachedObjects Page"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment