TextInputProperties
#include <bb/cascades/TextInputProperties>
Specifies text input properties for text input controls.
This is a grouped property that's used to specify input properties for the text field, such as what text is displayed on the Submit button on the keyboard, whether or not spell check should be used to verify the content, or other input-related configuration parameters. The impact and behavior of these flags are dependent on the input handler and are subject to change, and could behave differently on different devices. They should be considered hints.
In this example, the word "Connect" is displayed on the virtual keyboard and the submitted() signal is captured in order to initiate some sort of task in response. Spell checking is explicitly enabled and prediction is explicitly disabled for the control.
TextArea {
input {
submitKey: SubmitKey.Connect;
onSubmitted: {
// Perform some sort of action
}
flags: TextInputFlag.SpellCheck | TextInputFlag.PredictionOff
}
}
And here's the same example in C++:
TextArea* pTextArea = new TextArea(); pTextArea->input()->setSubmitKey(SubmitKey::Connect); QObject::connect(pTextArea->input(), SIGNAL(submitted()), this, SLOT(onSubmitted()));
BlackBerry 10.0.0
Inheritance
| bb::cascades::BaseObject | |||
| bb::cascades::UIObject | |||
| bb::cascades::TextInputProperties | |||
QML properties
| submitKey | : bb::cascades::SubmitKey::Type |
| flags | : bb::cascades::TextInputFlag::Types |
| submitKeyFocusBehavior | : bb::cascades::SubmitKeyFocusBehavior::Type |
| masking | : bb::cascades::TextInputMasking::Type |
| attachedObjects | : QDeclarativeListProperty< QObject > [read-only] |
| objectName | : QString |
| parent | : QObject [read-only] |
QML signals
Properties Index
| bb::cascades::SubmitKey::Type | submitKey |
| bb::cascades::TextInputFlag::Types | flags |
| bb::cascades::SubmitKeyFocusBehavior::Type | submitKeyFocusBehavior |
| bb::cascades::TextInputMasking::Type | masking |
| QDeclarativeListProperty< QObject > | attachedObjects [read-only] |
| QString | objectName |
| QObject | parent [read-only] |
Public Functions Index
| virtual | ~TextInputProperties () |
| bb::cascades::SubmitKeyFocusBehavior::Type | submitKeyFocusBehavior () |
| void | setSubmitKeyFocusBehavior (bb::cascades::SubmitKeyFocusBehavior::Type submitKeyFocusBehavior) |
| Q_SLOT void | resetSubmitKeyFocusBehavior () |
| void | setSubmitKey (bb::cascades::SubmitKey::Type submitKey) |
| Q_SLOT void | resetSubmitKey () |
| bb::cascades::SubmitKey::Type | submitKey () |
| void | setMasking (bb::cascades::TextInputMasking::Type masking) |
| Q_SLOT void | resetMasking () |
| bb::cascades::TextInputMasking::Type | masking () const |
| bb::cascades::TextInputFlag::Types | flags () const |
| void | setFlags (bb::cascades::TextInputFlag::Types flags) |
| Q_SLOT void | resetFlags () |
| virtual bool | event (QEvent *event) |
| void | setObjectName (const QString &name) |
| virtual Q_INVOKABLE QString | toDebugString () const |
Protected Functions Index
Only has inherited protected functions
| BaseObject (QObject *parent=0) | |
| virtual void | connectNotify (const char *signal) |
| virtual void | disconnectNotify (const char *signal) |
Signals Index
| void | submitted (bb::cascades::AbstractTextControl *submitter) |
| void | submitKeyChanged (const bb::cascades::SubmitKey::Type submitKey) |
| void | flagsChanged (bb::cascades::TextInputFlag::Types newFlags) |
| void | submitKeyFocusBehaviorChanged (bb::cascades::SubmitKeyFocusBehavior::Type newSubmitKeyFocusBehavior) |
| void | maskingChanged (bb::cascades::TextInputMasking::Type newMasking) |
| void | creationCompleted () |
| void | objectNameChanged (const QString &objectName) |
Properties
bb::cascades::SubmitKey::Type
Specifies which submit key to show on the virtual keyboard.
The default value is SubmitKey::Default, indicating that the keyboard should use whatever text is the default.
BlackBerry 10.0.0
bb::cascades::TextInputFlag::Types
Specifies text input feature flags.
This is a bit field that you can use to turn on and off input features. The default value is TextInputFlag::Default.
Here's an example of how to set text input flags:
TextArea {
input.flags: TextInputFlag.SpellCheck | TextInputFlag.PredictionOff;
}
bb::cascades::TextInputFlag::Types
BlackBerry 10.0.0
bb::cascades::SubmitKeyFocusBehavior::Type
Specifies text input focus behavior.
This property controls the focus behavior of the text control. For example, you can use this property to specify if the focus should change to another control when the Enter button is pressed.
This property applies only to controls where the submitKey property has been set. Otherwise, it will be ignored.
Here's an example of how to set the text input focus behavior:
TextField {
input.submitKeyFocusBehavior: SubmitKeyFocusBehavior.Keep;
}
BlackBerry 10.0.0
bb::cascades::TextInputMasking::Type
Specifies input masking mode.
The default value is TextInputMasking::Default, indicating that the system will decide if masking is turned on or off.
If the masking mode is set to TextInputMasking::MaskedNotTogglable or TextInputMasking::NotMaskedNotTogglable, the user is not allowed to toggle the masking mode using the text control UI. However, you can still provide your own control in your apps to change the masking model.
If the masking mode set to TextInputMasking::Masked or TextInputMasking::NotMasked, the user can toggle the masking mode by using a toggle box inside the text control.
Here's an example of how to set the input masking mode:
TextField {
inputMode: TextFieldInputMode.Password;
input.masking: TextInputMasking.NotMasked;
}
This property applies to password or numeric password text fields only.
BlackBerry 10.0.0
QDeclarativeListProperty< QObject >
A hierarchical list of the UIObject's attached objects.
This QDeclarativeListProperty can contain any QObject. When a QObject is added to property, the UIObject takes ownership of the attached object.
This feature is typically used from QML to specify business logic object or any other shared objects for the subnodes of this UIObject. In C++ the same functionality can be achived by setting a parent of a QObject to be attached to the QObject which is going to own it.
QML usage example (MyObject is a custom class registered for QML using the qmlRegisterType() function):
Container {
Label { text: "Title: " + myObject.title }
Label { text: "Subject: " + myObject.subject }
attachedObjects: [
MyObject { id: myObject
title: "Hello World"
subject: "Nice Day"
}
]
}
BlackBerry 10.0.0
QString
This property is overridden from QObject.
As the objectName property is overridden from the QObject class, this signal will not be emitted if setObjectName() function is called directly on QObject.
The default value of this property is QString::null.
QObject::objectName().
BlackBerry 10.0.0
QObject
A read-only property that represents this object's parent.
The parent of an object is specified using QObject::setParent(QObject*). The purpose of the property is to expose the object's parent to QML.
This property is read-only to prevent modifications from QML, where typically the parent is declaratively set. In C++ code, the parent can be explicitly set using QObject::setParent(QObject*), or implicitly set by adding it to a visual container.
The default value of this property is 0.
BlackBerry 10.0.0
Public Functions
virtual
Destructor.
bb::cascades::SubmitKeyFocusBehavior::Type
Retrieves the current submit key focus behavior.
The current submit key focus behavior.
BlackBerry 10.0.0
void
Sets the submit key focus behavior to use.
| Parameters | |
|---|---|
| submitKeyFocusBehavior |
The submit key focus behavior. |
BlackBerry 10.0.0
Q_SLOT void
Resets the submit key focus behavior to its default value.
BlackBerry 10.0.0
void
Sets which submit key to show on the virtual keyboard.
| Parameters | |
|---|---|
| submitKey |
The submit key to show. |
BlackBerry 10.0.0
Q_SLOT void
Resets the submit key to its default value of SubmitKey::Default.
BlackBerry 10.0.0
bb::cascades::SubmitKey::Type
Retrieves the current submit key.
The current submit key.
BlackBerry 10.0.0
void
Sets the input masking mode.
| Parameters | |
|---|---|
| masking |
The masking mode. |
BlackBerry 10.0.0
Q_SLOT void
Resets the masking mode to its default value of TextInputMasking::Default.
BlackBerry 10.0.0
bb::cascades::TextInputMasking::Type
Retrieves the current masking mode.
The current masking mode.
BlackBerry 10.0.0
bb::cascades::TextInputFlag::Types
Returns the text input flags.
The input flags are a bit field that you can use to turn on and off input features.
The flags bit field.
TextInputFlag::Types
BlackBerry 10.0.0
void
Sets the text input flags.
The input flags are a bit field that you can use to turn on and off input features. This function will emit the flagsChanged() signal.
Here's an example of how to set text input flags:
pTextField->input()->setFlags(TextInputFlag::SpellCheck | TextInputFlag::PredictionOff);
| Parameters | |
|---|---|
| flags |
The new text input flags. |
TextInputFlag::Types
BlackBerry 10.0.0
Q_SLOT void
Resets the input flags to the default state.
The default state is TextInputFlag::Default.
BlackBerry 10.0.0
virtual bool 
Overloaded to implement the event mechanism in Cascades.
If this function is overridden, it must be called by the derived class for events to work properly in Cascades.
| Parameters | |
|---|---|
| event |
The received event. |
True if the received event was recognized and processed, false otherwise.
BlackBerry 10.0.0
void 
Sets the objectName property.
| Parameters | |
|---|---|
| name |
The new name for the object. |
BlackBerry 10.0.0
virtual Q_INVOKABLE QString 
Returns a debug string representing this object.
A debug string for the object.
BlackBerry 10.0.0
Protected Functions
(Only has inherited protected functions)
Constructs an instance of BaseObject's subclass.
| Parameters | |
|---|---|
| parent |
An optional parent, defaults to 0. |
BlackBerry 10.0.0
virtual void 
Overloaded to implement the event mechanism in Cascades.
If this function is overridden, it must be called by the derived class for events to work properly in Cascades.
| Parameters | |
|---|---|
| signal |
The connected signal. |
BlackBerry 10.0.0
virtual void 
Overloaded to implement the event mechanism in Cascades.
If this function is overridden, it must be called by the derived class for events to work properly in Cascades.
| Parameters | |
|---|---|
| signal |
The disconnected signal. |
BlackBerry 10.0.0
Signals
void
Emitted when the submit key has been pressed.
This signal is emitted whenever the submit key is pressed, as long as the key has been set to something other than None or Default.
| Parameters | |
|---|---|
| submitter |
The text control that is the source of the submission. |
BlackBerry 10.0.0
void
Emitted when the submit key has changed.
| Parameters | |
|---|---|
| submitKey |
The new submit key. |
BlackBerry 10.0.0
void
Emitted when the input flags field has changed.
| Parameters | |
|---|---|
| newFlags |
The new flag bit field. |
BlackBerry 10.0.0
void
Emitted when the focus behavior for the submit key has changed.
| Parameters | |
|---|---|
| newSubmitKeyFocusBehavior |
The new behavior. |
BlackBerry 10.0.0
void
Emitted when the masking mode has changed.
| Parameters | |
|---|---|
| newMasking |
The new masking mode. |
BlackBerry 10.0.0
void 
This signal is emitted only when this object is instantiated as a result of loading a QML document and creating the root node, or when an object is being constructed using its builder class.
This signal is emitted only when this object is instantiated as a result of loading a QML document and creating the root node (only after the root component that caused this instantiation has completed construction), or when the object is being constructed from its builder class. This signal is emitted to indicate that the construction and initialization of the object has been completed, the properties are initialized, and any QML binding values have been assigned to the object.
This signal is not emitted when the object is constructed from C++ using the constructor. If the object is constructed using its builder class, the signal is emitted when the the builder class returns the fully constructed object.
This signal can be used when there is an activity that needs to be performed, such as a property state integrity verification after the object is instantiated from a QML document or a builder, but before control is returned to the application.
BlackBerry 10.0.0
void 
This signal is emitted when the objectName property is changed.
BlackBerry 10.0.0