summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlinecontrol_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2010-06-05 19:20:23 (GMT)
committerLars Knoll <lars.knoll@nokia.com>2010-06-09 22:07:34 (GMT)
commit1533e7251d1dc4318b87ec799f0367f5fca0b092 (patch)
tree554c742cff985ffc261a92c588ee3b54bd76b0f9 /src/gui/widgets/qlinecontrol_p.h
parent6287977849ff5cab64a944fb0590d306a79f3637 (diff)
downloadQt-1533e7251d1dc4318b87ec799f0367f5fca0b092.zip
Qt-1533e7251d1dc4318b87ec799f0367f5fca0b092.tar.gz
Qt-1533e7251d1dc4318b87ec799f0367f5fca0b092.tar.bz2
Correct BiDi behavior of QLineEdit
* LayoutDirectionChange event doesn't affect the text anymore. * Default text direction is determined from string * Qt::Key_Direction_L/R forces the layout direction Task-number: Part of Qt-3292 Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/gui/widgets/qlinecontrol_p.h')
-rw-r--r--src/gui/widgets/qlinecontrol_p.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 5da1831..b419adf 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -78,7 +78,7 @@ class Q_GUI_EXPORT QLineControl : public QObject
public:
QLineControl(const QString &txt = QString())
- : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LeftToRight),
+ : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
m_hideCursor(false), m_separator(0), m_readOnly(0),
m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0),
@@ -272,7 +272,11 @@ public:
QChar passwordCharacter() const { return m_passwordCharacter; }
void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
- Qt::LayoutDirection layoutDirection() const { return m_layoutDirection; }
+ Qt::LayoutDirection layoutDirection() const {
+ if (m_layoutDirection == Qt::LayoutDirectionAuto)
+ return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
+ return m_layoutDirection;
+ }
void setLayoutDirection(Qt::LayoutDirection direction)
{
if (direction != m_layoutDirection) {