main.qml Example File
regexp/assets/main.qml
import bb.cascades 1.0
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
Label {
horizontalAlignment: HorizontalAlignment.Center
preferredHeight: 200
text: qsTr ("Regular Expression Example")
textStyle {
base: SystemDefaults.TextStyles.TitleText
color: Color.Black
fontWeight: FontWeight.Bold
}
}
ScrollView {
scrollViewProperties {
scrollMode: ScrollMode.Vertical
}
Container {
leftPadding: 20
rightPadding: 20
attachedObjects: [
TextStyleDefinition {
id: tsd
base: SystemDefaults.TextStyles.BodyText
color: Color.Black
},
TextStyleDefinition {
id: tsh
base: tsd.style
fontWeight: FontWeight.Bold
}
]
Label {
text: qsTr ("Inputs:")
textStyle {
base: SystemDefaults.TextStyles.TitleText
color: Color.Black
fontWeight: FontWeight.Bold
}
}
Label {
leftMargin: 10
topMargin: 10
text: qsTr ("Pattern:")
textStyle {
base: tsh.style
}
}
TextField {
leftMargin: 10
topMargin: 10
preferredWidth: 500
text: _regexp.pattern
onTextChanging: _regexp.pattern = text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
text: qsTr ("Escaped Pattern:")
textStyle {
base: tsh.style
}
}
Label {
text: _regexp.escapedPattern
textStyle {
base: tsd.style
}
}
DropDown {
title: qsTr ("Pattern Syntax:")
onSelectedIndexChanged: _app.setPatternSyntax (selectedIndex)
Option {
text: qsTr ("Regular expression v1")
selected: true
}
Option {
text: qsTr ("Regular expression v2")
}
Option {
text: qsTr ("Wildcard")
}
Option {
text: qsTr ("Fixed string")
}
Option {
text: qsTr ("W3C Xml Schema 1.1")
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Container {
topMargin: 10
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
CheckBox {
checked: true
onCheckedChanged: _regexp.caseSensitive = checked
}
Label {
leftMargin: 10
text: qsTr ("Case Sensitive")
textStyle {
base: tsh.style
}
}
}
Container {
topMargin: 10
leftMargin: 25
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
CheckBox {
onCheckedChanged: _regexp.minimal = checked
}
Label {
leftMargin: 10
text: qsTr ("Minimal")
textStyle {
base: tsh.style
}
}
}
}
Label {
topMargin: 10
text: qsTr ("Text:")
textStyle {
base: tsh.style
}
}
TextField {
preferredWidth: 500
text: _regexp.text
textStyle {
base: tsd.style
}
onTextChanging: _regexp.text = text
}
Label {
text: qsTr ("Outputs:")
textStyle {
base: SystemDefaults.TextStyles.TitleText
fontWeight: FontWeight.Bold
color: Color.Black
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Label {
topMargin: 10
text: qsTr ("Index of Match:")
textStyle {
base: tsh.style
}
}
Label {
text: _regexp.matchIndex + ""
textStyle {
base: tsd.style
}
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Label {
topMargin: 10
text: qsTr ("Matched Length:")
textStyle {
base: tsh.style
}
}
Label {
text: _regexp.matchLength + ""
textStyle {
base: tsd.style
}
}
}
Label {
topMargin: 10
enabled: _regexp.capture0Available
text: qsTr ("Match:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture0Available
text: _regexp.capture0Text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
enabled: _regexp.capture1Available
text: qsTr ("Capture 1:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture1Available
text: _regexp.capture1Text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
enabled: _regexp.capture2Available
text: qsTr ("Capture 2:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture2Available
text: _regexp.capture2Text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
enabled: _regexp.capture3Available
text: qsTr ("Capture 3:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture3Available
text: _regexp.capture3Text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
enabled: _regexp.capture4Available
text: qsTr ("Capture 4:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture4Available
text: _regexp.capture4Text
textStyle {
base: tsd.style
}
}
Label {
topMargin: 10
enabled: _regexp.capture5Available
text: qsTr ("Capture 5:")
textStyle {
base: tsh.style
}
}
Label {
enabled: _regexp.capture5Available
text: _regexp.capture5Text
textStyle {
base: tsd.style
}
}
}
}
}
}
}