TextInputProperties

Since: BlackBerry 10.0.0

#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()));
See also:

SubmitKey


Overview

Inheritance

bb::cascades::BaseObject
bb::cascades::UIObject
bb::cascades::TextInputProperties

QML properties

flags: bb::cascades::TextInputFlag::Types
keyLayout: bb::cascades::KeyLayout::Type
masking: bb::cascades::TextInputMasking::Type
submitKey: bb::cascades::SubmitKey::Type
submitKeyFocusBehavior: bb::cascades::SubmitKeyFocusBehavior::Type
attachedObjects: QDeclarativeListProperty< QObject > [read-only]Inherited
objectName: QStringInherited
parent: QObject [read-only]Inherited
ui: bb::cascades::UIConfig [read-only]Inherited

Public Functions Index

virtual ~TextInputProperties ()
bb::cascades::TextInputFlag::Typesflags () const
bb::cascades::KeyLayout::TypekeyLayout () const
bb::cascades::TextInputMasking::Typemasking () const
Q_SLOT voidresetFlags ()
Q_SLOT voidresetKeyLayout ()
Q_SLOT voidresetMasking ()
Q_SLOT voidresetSubmitKey ()
Q_SLOT voidresetSubmitKeyFocusBehavior ()
voidsetFlags (bb::cascades::TextInputFlag::Types flags)
Q_SLOT voidsetKeyLayout (bb::cascades::KeyLayout::Type keyLayout)
voidsetMasking (bb::cascades::TextInputMasking::Type masking)
voidsetSubmitKey (bb::cascades::SubmitKey::Type submitKey)
voidsetSubmitKeyFocusBehavior (bb::cascades::SubmitKeyFocusBehavior::Type submitKeyFocusBehavior)
bb::cascades::SubmitKey::TypesubmitKey ()
bb::cascades::SubmitKeyFocusBehavior::TypesubmitKeyFocusBehavior ()
virtual boolevent (QEvent *event)Inherited
voidsetObjectName (const QString &name)Inherited
virtual Q_INVOKABLE QStringtoDebugString () const Inherited
Q_INVOKABLE bb::cascades::UIConfig *ui () const Inherited

Protected Functions Index

Only has inherited protected functions

BaseObject (QObject *parent=0)Inherited
virtual voidconnectNotify (const char *signal)Inherited
virtual voiddisconnectNotify (const char *signal)Inherited

Signals Index

voidflagsChanged (bb::cascades::TextInputFlag::Types newFlags)
voidkeyLayoutChanged (bb::cascades::KeyLayout::Type newKeyLayout)
voidmaskingChanged (bb::cascades::TextInputMasking::Type newMasking)
voidsubmitKeyChanged (const bb::cascades::SubmitKey::Type submitKey)
voidsubmitKeyFocusBehaviorChanged (bb::cascades::SubmitKeyFocusBehavior::Type newSubmitKeyFocusBehavior)
voidsubmitted (bb::cascades::AbstractTextControl *submitter)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

bb::cascades::TextInputFlag::Types flags

Specifies text input feature flags.

See also:

bb::cascades::TextInputFlag::Types

Since:

BlackBerry 10.0.0

bb::cascades::KeyLayout::Type keyLayout

Specifies the key layout.

This property controls the layout of the keys on the virtual keyboard, or the interpretation of keys on a physical keyboard.

The default value is KeyLayout::Default, which means that the key layout is chosen based on the input mode of either the TextField or TextArea.

The following example creates a TextArea with a preferred keyLayout of KeyLayout.Pin:
TextArea
{
    id: pinEditor
    input
    {
        keyLayout: KeyLayout.Pin
    }
}

See also:

KeyLayout

Since:

BlackBerry 10.3.0

bb::cascades::TextInputMasking::Type masking

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;
}
Note:

This property applies to password or numeric password text fields only.

Since:

BlackBerry 10.0.0

bb::cascades::SubmitKey::Type submitKey

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.

See also:

SubmitKey::Type

Since:

BlackBerry 10.0.0

bb::cascades::SubmitKeyFocusBehavior::Type submitKeyFocusBehavior

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;
}
Since:

BlackBerry 10.0.0

QDeclarativeListProperty< QObject > attachedObjectsInherited[read-only]

A hierarchical list of the UIObject's attached objects.

Since:

BlackBerry 10.0.0

QString objectNameInherited

This property is overridden from QObject.

See also:

QObject::objectName().

Since:

BlackBerry 10.0.0

QObject parentInherited[read-only]

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.

Since:

BlackBerry 10.0.0

bb::cascades::UIConfig uiInherited[read-only]

An object that gives access to unit conversion routines.

QML use:
        // Size using design units
        Container {
            preferredWidth: ui.du(12)
            preferredHeight: ui.du(5)
        }

        // Size using design units, snap to whole pixels
        Container {
            preferredWidth: ui.sdu(13.5)
            preferredHeight: ui.sdu(7.5)
        }

        // Size using absolute pixel values
        Container {
            preferredWidth: ui.px(150)
            preferredHeight: ui.px(50)
        }
C++ use:
Container *container1 = Container::create().background(Color::Red);
UIConfig *ui = container1->ui();
container1->setPreferredWidth(ui->du(12));
container1->setPreferredHeight(ui->du(5));

Container *container2 = Container::create().background(Color::Green);
container2->setPreferredWidth(ui->sdu(13.5));
container2->setPreferredHeight(ui->sdu(7.5));

Container *container3 = Container::create().background(Color::Blue);
container3->setPreferredWidth(ui->px(150));
container3->setPreferredHeight(ui->sdu(50));
Since:

Blackberry 10.3.0

Public Functions

virtual~TextInputProperties ()

Destructor.

bb::cascades::TextInputFlag::Types flags ()

Returns the text input flags.

The input flags are a bit field that you can use to turn on and off input features.

Return:

The flags bit field.

See also:

TextInputFlag::Types

Since:

BlackBerry 10.0.0

bb::cascades::KeyLayout::Type keyLayout ()

Gets the current preferred key layout.

Return:

The current key layout.

Since:

BlackBerry 10.3.0

bb::cascades::TextInputMasking::Type masking ()

Retrieves the current masking mode.

Return:

The current masking mode.

Since:

BlackBerry 10.0.0

Q_SLOT void resetFlags ()

Resets the input flags to the default state.

The default state is TextInputFlag::Default.

Since:

BlackBerry 10.0.0

Q_SLOT void resetKeyLayout ()

Resets the preferred key layout to the default value.

The default value for the key layout is KeyLayout::Default.

Since:

BlackBerry 10.3.0

Q_SLOT void resetMasking ()

Resets the masking mode to its default value of TextInputMasking::Default.

Since:

BlackBerry 10.0.0

Q_SLOT void resetSubmitKey ()

Resets the submit key to its default value of SubmitKey::Default.

Since:

BlackBerry 10.0.0

Q_SLOT void resetSubmitKeyFocusBehavior ()

Resets the submit key focus behavior to its default value.

Since:

BlackBerry 10.0.0

void setFlags (
  • bb::cascades::TextInputFlag::Typesflags)

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.

See also:

TextInputFlag::Types

Since:

BlackBerry 10.0.0

Q_SLOT void setKeyLayout (

Sets the current preferred key layout.

Parameters
keyLayout

The new key layout to be set.

Since:

BlackBerry 10.3.0

void setMasking (

Sets the input masking mode.

Parameters
masking

The masking mode.

Since:

BlackBerry 10.0.0

void setSubmitKey (

Sets which submit key to show on the virtual keyboard.

Parameters
submitKey

The submit key to show.

Since:

BlackBerry 10.0.0

void setSubmitKeyFocusBehavior (

Sets the submit key focus behavior to use.

Parameters
submitKeyFocusBehavior

The submit key focus behavior.

Since:

BlackBerry 10.0.0

bb::cascades::SubmitKey::Type submitKey ()

Retrieves the current submit key.

Return:

The current submit key.

Since:

BlackBerry 10.0.0

bb::cascades::SubmitKeyFocusBehavior::Type submitKeyFocusBehavior ()

Retrieves the current submit key focus behavior.

Return:

The current submit key focus behavior.

Since:

BlackBerry 10.0.0

virtual bool event (Inherited

Overloaded to implement the event mechanism in Cascades.

Warning!

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.

Return:

True if the received event was recognized and processed, false otherwise.

Since:

BlackBerry 10.0.0

void setObjectName (Inherited

Sets the objectName property.

Parameters
name

The new name for the object.

Since:

BlackBerry 10.0.0

virtual Q_INVOKABLE QString toDebugString ()Inherited

Returns a debug string representing this object.

Return:

A debug string for the object.

Since:

BlackBerry 10.0.0

Q_INVOKABLE bb::cascades::UIConfig * ui ()Inherited

Returns the UIConfig for this ui object.

The UIConfig can be used to perform unit conversions from design units (du) and snapped design units (sdu) to pixels.

Ownership remains with Cascades.

C++ use:
Container *container1 = Container::create().background(Color::Red);
UIConfig *ui = container1->ui();
container1->setPreferredWidth(ui->du(12));
container1->setPreferredHeight(ui->du(5));

Container *container2 = Container::create().background(Color::Green);
container2->setPreferredWidth(ui->sdu(13.5));
container2->setPreferredHeight(ui->sdu(7.5));

Container *container3 = Container::create().background(Color::Blue);
container3->setPreferredWidth(ui->px(150));
container3->setPreferredHeight(ui->sdu(50));
Return:

The UIConfig for this ui object.

Since:

BlackBerry 10.3.0

Protected Functions

(Only has inherited protected functions)

BaseObject (Inherited

Constructs an instance of BaseObject's subclass.

Parameters
parent

An optional parent, defaults to 0.

Since:

BlackBerry 10.0.0

virtual void connectNotify (
  • const char *signal)
Inherited

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.

Since:

BlackBerry 10.0.0

virtual void disconnectNotify (
  • const char *signal)
Inherited

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.

Since:

BlackBerry 10.0.0

Signals

void flagsChanged (
  • bb::cascades::TextInputFlag::TypesnewFlags)

Emitted when the input flags field has changed.

Parameters
newFlags

The new flag bit field.

Since:

BlackBerry 10.0.0

void keyLayoutChanged (

Emitted when the key layout has changed.

Parameters
newKeyLayout

The new key layout.

Since:

BlackBerry 10.3.0

void maskingChanged (

Emitted when the masking mode has changed.

Parameters
newMasking

The new masking mode.

Since:

BlackBerry 10.0.0

void submitKeyChanged (

Emitted when the submit key has changed.

Parameters
submitKey

The new submit key.

Since:

BlackBerry 10.0.0

void submitKeyFocusBehaviorChanged (

Emitted when the focus behavior for the submit key has changed.

Parameters
newSubmitKeyFocusBehavior

The new behavior.

Since:

BlackBerry 10.0.0

void submitted (

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.

See also:

SubmitKey::Type

Since:

BlackBerry 10.0.0

void creationCompleted ()Inherited

Emitted 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 indicates 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.

See also:

QmlDocument

Since:

BlackBerry 10.0.0

void objectNameChanged (Inherited

This signal is emitted when the objectName property is changed.

Since:

BlackBerry 10.0.0

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus