summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetextinput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextinput.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 8d320f4b8a..633c01e65c 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -56,17 +56,20 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextInput QDeclarativeTextInput
\since 4.7
- \brief The TextInput item allows you to add an editable line of text to a scene.
+ \brief The TextInput item displays an editable line of text.
\inherits Item
- TextInput can only display a single line of text, and can only display
- plain text. However it can provide addition input constraints on the text.
+ The TextInput element displays a single line of editable plain text.
- Input constraints include setting a QValidator, an input mask, or a
- maximum input length.
+ TextInput is used to accept a line of text input. Input constraints
+ can be placed on a TextInput item (for example, through a \l validator or \l inputMask),
+ and setting \l echoMode to an appropriate value enables TextInput to be used for
+ a password input field.
On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled.
If you want such bindings (on any platform), you will need to construct them in QML.
+
+ \sa TextEdit, Text
*/
QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent)
: QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
@@ -249,7 +252,12 @@ QColor QDeclarativeTextInput::color() const
void QDeclarativeTextInput::setColor(const QColor &c)
{
Q_D(QDeclarativeTextInput);
- d->color = c;
+ if (c != d->color) {
+ d->color = c;
+ clearCache();
+ update();
+ emit colorChanged(c);
+ }
}
@@ -553,7 +561,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
/*!
\qmlclass IntValidator QIntValidator
- This element provides a validator for integer values
+ This element provides a validator for integer values.
*/
/*!
\qmlproperty int IntValidator::top
@@ -596,10 +604,14 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
\qmlproperty enumeration DoubleValidator::notation
This property holds the notation of how a string can describe a number.
- The values for this property are DoubleValidator.StandardNotation or DoubleValidator.ScientificNotation.
- If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part(i.e. 1.5E-2).
+ The possible values for this property are:
+
+ \list
+ \o DoubleValidator.StandardNotation
+ \o DoubleValidator.ScientificNotation (default)
+ \endlist
- By default, this property is set to DoubleValidator.ScientificNotation.
+ If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part (e.g. 1.5E-2).
*/
/*!
@@ -1234,9 +1246,9 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
your application.
By default the opening of input panels follows the platform style. On Symbian^1 and
- Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
- manually closed by the user. On other platforms the panels are automatically opened
- when TextInput element gains focus and closed when the focus is lost.
+ Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms
+ the panels are automatically opened when TextInput element gains focus. Input panels are
+ always closed if no editor owns focus.
. You can disable the automatic behavior by setting the property \c focusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
@@ -1258,9 +1270,9 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
textInput.openSoftwareInputPanel();
} else {
textInput.focus = false;
- textInput.closeSoftwareInputPanel();
}
}
+ onPressAndHold: textInput.closeSoftwareInputPanel();
}
}
\endqml
@@ -1285,9 +1297,9 @@ void QDeclarativeTextInput::openSoftwareInputPanel()
your application.
By default the opening of input panels follows the platform style. On Symbian^1 and
- Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
- manually closed by the user. On other platforms the panels are automatically opened
- when TextInput element gains focus and closed when the focus is lost.
+ Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms
+ the panels are automatically opened when TextInput element gains focus. Input panels are
+ always closed if no editor owns focus.
. You can disable the automatic behavior by setting the property \c focusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
@@ -1309,9 +1321,9 @@ void QDeclarativeTextInput::openSoftwareInputPanel()
textInput.openSoftwareInputPanel();
} else {
textInput.focus = false;
- textInput.closeSoftwareInputPanel();
}
}
+ onPressAndHold: textInput.closeSoftwareInputPanel();
}
}
\endqml
@@ -1333,24 +1345,13 @@ void QDeclarativeTextInput::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
if (d->showInputPanelOnFocus) {
- if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
+ if (d->focusOnPress && !isReadOnly()) {
openSoftwareInputPanel();
}
}
QDeclarativePaintedItem::focusInEvent(event);
}
-void QDeclarativeTextInput::focusOutEvent(QFocusEvent *event)
-{
- Q_D(const QDeclarativeTextInput);
- if (d->showInputPanelOnFocus) {
- if (d->focusOnPress && !isReadOnly()) {
- closeSoftwareInputPanel();
- }
- }
- QDeclarativePaintedItem::focusOutEvent(event);
-}
-
void QDeclarativeTextInputPrivate::init()
{
Q_Q(QDeclarativeTextInput);