diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/quick/items/qquicktextinput.cpp | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 989c0db3ab..2bd3a3da37 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -155,7 +155,8 @@ void QQuickTextInput::setText(const QString &s) combination with the NativeRendering render type will lend poor and sometimes pixelated results. - On HighDpi "retina" displays this property is ignored and QtRendering is always used. + On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored + and QtRendering is always used. */ QQuickTextInput::RenderType QQuickTextInput::renderType() const { @@ -778,7 +779,10 @@ QRectF QQuickTextInput::cursorRectangle() const QTextLine l = d->m_textLayout.lineForTextPosition(c); if (!l.isValid()) return QRectF(); - return QRectF(l.cursorToX(c) - d->hscroll, l.y() - d->vscroll, 1, l.height()); + qreal x = l.cursorToX(c) - d->hscroll; + qreal y = l.y() - d->vscroll; + qreal height = l.ascent() + l.descent(); + return QRectF(x, y, 1, height); } /*! @@ -1227,10 +1231,11 @@ Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const Specifies how the text should be displayed in the TextInput. \list \li TextInput.Normal - Displays the text as it is. (Default) - \li TextInput.Password - Displays asterisks instead of characters. + \li TextInput.Password - Displays platform-dependent password mask + characters instead of the actual characters. \li TextInput.NoEcho - Displays nothing. \li TextInput.PasswordEchoOnEdit - Displays characters as they are entered - while editing, otherwise displays asterisks. + while editing, otherwise identical to \c TextInput.Password. \endlist */ QQuickTextInput::EchoMode QQuickTextInput::echoMode() const @@ -1372,9 +1377,12 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const pos += d->preeditAreaText().length(); #endif QTextLine l = d->m_textLayout.lineForTextPosition(pos); - return l.isValid() - ? QRectF(l.cursorToX(pos) - d->hscroll, l.y() - d->vscroll, 1, l.height()) - : QRectF(); + if (!l.isValid()) + return QRectF(); + qreal x = l.cursorToX(pos) - d->hscroll; + qreal y = l.y() - d->vscroll; + qreal height = l.ascent() + l.descent(); + return QRectF(x, y, 1, height); } /*! @@ -1465,7 +1473,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev) int cursorPosition = d->m_cursor; if (cursorPosition == 0) ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right); - if (!ignore && cursorPosition == text().length()) + if (!ignore && cursorPosition == d->m_text.length()) ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left); } if (ignore) { @@ -2194,7 +2202,8 @@ void QQuickTextInput::selectWord() \qmlproperty string QtQuick2::TextInput::passwordCharacter This is the character displayed when echoMode is set to Password or - PasswordEchoOnEdit. By default it is an asterisk. + PasswordEchoOnEdit. By default it is the password character used by + the platform theme. If this property is set to a string with more than one character, the first character is used. If the string is empty, the value |