EditorField.qml Example File
accounts/assets/EditorField.qml
import bb.cascades 1.0
Container {
id: root
property string type
property string title
property variant value
topMargin: 50
onTitleChanged: {
if (type == "string")
textField.hintText = title
else if (type == "email")
emailField.hintText = title
else if (type == "boolean")
booleanField.text = title
else if (type == "number")
numberField.hintText = title
}
onValueChanged: {
if (type == "string") {
textField.text = value
} else if (type == "email")
emailField.text = value
else if (type == "boolean")
booleanField.checked = value
else if (type == "number")
numberField.text = value
}
TextField {
id: textField
visible: (root.type == "string")
onTextChanging: root.value = text
}
TextField {
id: emailField
inputMode: TextFieldInputMode.EmailAddress
visible: (root.type == "email")
onTextChanging: root.value = text
}
CheckBox {
id: booleanField
visible: (root.type == "boolean")
onCheckedChanged: root.value = checked
}
TextField {
id: numberField
inputMode: TextFieldInputMode.NumbersAndPunctuation
visible: (root.type == "number")
onTextChanging: root.value = text
}
}