From b69e592b2b8fb3eae75c112e491e3ed90fc0248a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 5 Jun 2010 23:21:59 +0200 Subject: For an empty line edit the cursor position is depending on input language Ensure the cursor is on the right if the keyboard layout is for a right to left language. Task-number: Part of Qt-3292 Reviewed-by: Simon Hausmann --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 1 - src/gui/widgets/qlinecontrol_p.h | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 1202101..8d320f4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1356,7 +1356,6 @@ void QDeclarativeTextInputPrivate::init() Q_Q(QDeclarativeTextInput); control->setCursorWidth(1); control->setPasswordCharacter(QLatin1Char('*')); - control->setLayoutDirection(Qt::LeftToRight); q->setSmooth(smooth); q->setAcceptedMouseButtons(Qt::LeftButton); q->setFlag(QGraphicsItem::ItemHasNoContents, false); diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index b419adf..7068f62 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -273,8 +273,11 @@ public: void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); } Qt::LayoutDirection layoutDirection() const { - if (m_layoutDirection == Qt::LayoutDirectionAuto) + if (m_layoutDirection == Qt::LayoutDirectionAuto) { + if (m_text.isEmpty()) + return QApplication::keyboardInputDirection(); return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + } return m_layoutDirection; } void setLayoutDirection(Qt::LayoutDirection direction) -- cgit v0.12