summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-03-08 04:33:29 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-08 06:58:11 (GMT)
commit54de06c6f3bd7ef74a10bfab9bff5416078edd6f (patch)
tree80e49e446f417138bae41750a0b179b4a0e5299c /src/declarative/graphicsitems
parentc783cbfe3839d7a4c0f75613d2a94e8cfb7a29d1 (diff)
downloadQt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.zip
Qt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.tar.gz
Qt-54de06c6f3bd7ef74a10bfab9bff5416078edd6f.tar.bz2
Base empty QML editor horizontal alignment on QApplication::keyboardInputDirection()
Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: I240d53c8572fd3d1222b555e93812a3ee38e2558
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp5
3 files changed, 8 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 4a931fd..f0d0221 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1120,7 +1120,8 @@ bool QDeclarativeTextPrivate::determineHorizontalAlignment()
Q_Q(QDeclarativeText);
if (hAlignImplicit && q->isComponentComplete()) {
// if no explicit alignment has been set, follow the natural layout direction of the text
- return setHAlign(text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft);
+ bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft();
+ return setHAlign(isRightToLeft ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft);
}
return false;
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 75a22d1..d1d2351 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -550,7 +550,8 @@ bool QDeclarativeTextEditPrivate::determineHorizontalAlignment()
Q_Q(QDeclarativeTextEdit);
if (hAlignImplicit && q->isComponentComplete()) {
// if no explicit alignment has been set, follow the natural layout direction of the text
- return setHAlign(text.isRightToLeft() ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft);
+ bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft();
+ return setHAlign(isRightToLeft ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft);
}
return false;
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 6305eaa..850c212 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -411,7 +411,9 @@ bool QDeclarativeTextInputPrivate::determineHorizontalAlignment()
{
if (hAlignImplicit) {
// if no explicit alignment has been set, follow the natural layout direction of the text
- return setHAlign(control->text().isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft);
+ QString text = control->text();
+ bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft();
+ return setHAlign(isRightToLeft ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft);
}
return false;
}
@@ -1872,6 +1874,7 @@ void QDeclarativeTextInputPrivate::init()
QPalette p = control->palette();
selectedTextColor = p.color(QPalette::HighlightedText);
selectionColor = p.color(QPalette::Highlight);
+ determineHorizontalAlignment();
}
void QDeclarativeTextInput::cursorPosChanged()