summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qlinecontrol_p.h8
-rw-r--r--src/gui/widgets/qlineedit.cpp5
2 files changed, 7 insertions, 6 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) {
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index c1c4abf..1bffde1 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1860,7 +1860,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
p.setClipRect(r);
QFontMetrics fm = fontMetrics();
- Qt::Alignment va = QStyle::visualAlignment(layoutDirection(), QFlag(d->alignment));
+ Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment));
switch (va & Qt::AlignVertical_Mask) {
case Qt::AlignBottom:
d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin;
@@ -2161,9 +2161,6 @@ void QLineEdit::changeEvent(QEvent *ev)
}
update();
break;
- case QEvent::LayoutDirectionChange:
- d->control->setLayoutDirection(layoutDirection());
- break;
default:
break;
}