summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2010-01-27 14:54:25 (GMT)
committerRobert Griebl <rgriebl@trolltech.com>2010-03-18 15:28:02 (GMT)
commit9b4ca998930c7b81b72e5068b3ebae33907ac4b2 (patch)
tree45fcf1e83a04472c4a08a9446d2a4dca270f7f8a /src/gui/widgets
parent6ac26093169e6ab89a868f8b71488ef29ecf3c3b (diff)
downloadQt-9b4ca998930c7b81b72e5068b3ebae33907ac4b2.zip
Qt-9b4ca998930c7b81b72e5068b3ebae33907ac4b2.tar.gz
Qt-9b4ca998930c7b81b72e5068b3ebae33907ac4b2.tar.bz2
Always redraw the complete control when an input event comes in.
The problem here is that a pre-edit string won't be detected by updateDisplayText(), so the control thinks nothing has changed when a new pre-edit string is set. Reviewed-By: Simon Hausmann (cherry picked from commit 16f30906f6eea3e00351478555f153697a6e186d)
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp6
-rw-r--r--src/gui/widgets/qlinecontrol_p.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index db099e8..9ec0feb 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
Updates the display text based of the current edit text
If the text has changed will emit displayTextChanged()
*/
-void QLineControl::updateDisplayText()
+void QLineControl::updateDisplayText(bool forceUpdate)
{
QString orig = m_textLayout.text();
QString str;
@@ -102,7 +102,7 @@ void QLineControl::updateDisplayText()
m_textLayout.endLayout();
m_ascent = qRound(l.ascent());
- if (str != orig)
+ if (str != orig || forceUpdate)
emit displayTextChanged(str);
}
@@ -476,7 +476,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
}
}
m_textLayout.setAdditionalFormats(formats);
- updateDisplayText();
+ updateDisplayText(/*force*/ true);
if (cursorPositionChanged)
emitCursorPositionChanged();
if (isGettingInput)
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index d6f2705..3f1bc2c 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -239,7 +239,7 @@ private:
void init(const QString &txt);
void removeSelectedText();
void internalSetText(const QString &txt, int pos = -1, bool edited = true);
- void updateDisplayText();
+ void updateDisplayText(bool forceUpdate = false);
void internalInsert(const QString &s);
void internalDelete(bool wasBackspace = false);