aboutsummaryrefslogtreecommitdiffstats
path: root/src/qtquick1/graphicsitems
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-09-12 08:12:58 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-09-12 08:12:58 +0200
commitd77218522eb480c8d528de18049cd7b604cdeb2a (patch)
treea6433a8e9205a95006eae10b53285a0e3487423d /src/qtquick1/graphicsitems
parent589c8445e2623ef8e0b8294d7c558a2948b2a5e3 (diff)
parentd5686fa2ac2248d5a31237573fa08697f18f035f (diff)
Merge branch 'master' into refactor
Conflicts: examples/declarative/cppextensions/qwidgets/qwidgets.pro examples/declarative/minehunt/main.cpp examples/declarative/minehunt/minehunt.pro src/declarative/items/context2d/qsgcontext2d.cpp src/declarative/items/qsgflickable.cpp src/declarative/items/qsgtextedit.cpp src/declarative/items/qsgtextinput.cpp src/declarative/particles/qsgangleddirection.cpp src/declarative/particles/qsgcumulativedirection.cpp src/declarative/particles/qsgcumulativedirection_p.h src/declarative/particles/qsgfollowemitter.cpp src/declarative/particles/qsgmodelparticle.cpp src/declarative/particles/qsgparticlesystem.cpp src/qtquick1/util/qdeclarativeview.h tests/auto/declarative/examples/examples.pro tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp Change-Id: Ib4be2a5e742dee1a399d73da97161736f77448e5
Diffstat (limited to 'src/qtquick1/graphicsitems')
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativetextedit.cpp11
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativetextinput.cpp9
2 files changed, 17 insertions, 3 deletions
diff --git a/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp b/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp
index 777d964716..27ef5438ef 100644
--- a/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp
@@ -553,7 +553,15 @@ bool QDeclarative1TextEditPrivate::determineHorizontalAlignment()
{
Q_Q(QDeclarative1TextEdit);
if (hAlignImplicit && q->isComponentComplete()) {
- bool alignToRight = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : rightToLeftText;
+ bool alignToRight;
+ if (text.isEmpty()) {
+ const QString preeditText = control->textCursor().block().layout()->preeditAreaText();
+ alignToRight = preeditText.isEmpty()
+ ? QApplication::keyboardInputDirection() == Qt::RightToLeft
+ : preeditText.isRightToLeft();
+ } else {
+ alignToRight = rightToLeftText;
+ }
return setHAlign(alignToRight ? QDeclarative1TextEdit::AlignRight : QDeclarative1TextEdit::AlignLeft);
}
return false;
@@ -1589,6 +1597,7 @@ void QDeclarative1TextEdit::q_textChanged()
void QDeclarative1TextEdit::moveCursorDelegate()
{
Q_D(QDeclarative1TextEdit);
+ d->determineHorizontalAlignment();
updateMicroFocus();
emit cursorRectangleChanged();
if(!d->cursor)
diff --git a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
index 544e35d46d..3a36e6b070 100644
--- a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
@@ -414,7 +414,11 @@ bool QDeclarative1TextInputPrivate::determineHorizontalAlignment()
if (hAlignImplicit) {
// if no explicit alignment has been set, follow the natural layout direction of the text
QString text = control->text();
- bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft();
+ if (text.isEmpty())
+ text = control->preeditAreaText();
+ bool isRightToLeft = text.isEmpty()
+ ? QApplication::keyboardInputDirection() == Qt::RightToLeft
+ : text.isRightToLeft();
return setHAlign(isRightToLeft ? QDeclarative1TextInput::AlignRight : QDeclarative1TextInput::AlignLeft);
}
return false;
@@ -1059,7 +1063,7 @@ void QDeclarative1TextInputPrivate::focusChanged(bool hasFocus)
Q_Q(QDeclarative1TextInput);
focused = hasFocus;
q->setCursorVisible(hasFocus && scene && scene->hasFocus());
- if(q->echoMode() == QDeclarative1TextInput::PasswordEchoOnEdit && !hasFocus)
+ if(!hasFocus && control->passwordEchoEditing())
control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events
if (!hasFocus)
control->deselect();
@@ -1915,6 +1919,7 @@ void QDeclarative1TextInput::cursorPosChanged()
void QDeclarative1TextInput::updateCursorRectangle()
{
Q_D(QDeclarative1TextInput);
+ d->determineHorizontalAlignment();
d->updateHorizontalScroll();
updateRect();//TODO: Only update rect between pos's
updateMicroFocus();