summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2013-02-01 12:41:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-21 18:19:40 +0100
commitc9e96db7879d793d5ea12b6a0a2d6bce74c3e537 (patch)
tree4ae7d9cd9d442d7a1261ded2eee5ca9853c07685 /src/gui/text
parentb9b3acf39e9e3b5b7288b4f4f8c7246606e16d0d (diff)
Fix text issue with Hiragana characters when stylesheet is applied.
When typing into a QTextEdit or QLineEdit with a Japanese IME on Windows, some characters have both a black foreground and background and hence cannot be seen. This patch fixes the issue by setting the appropriate colors for the text in these scenarios. The change also fixes a similar situation with QSyntaxHighlighter and Hiragana, where the background and foreground colors were the same. Now it will use underlining to highlight the text (like WordPad does, for example). Task-number: QTBUG-29442 Change-Id: I364d327a8f6573a73b227b79cc5f570cd02611c9 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Titta Heikkala <titta.heikkala@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextcontrol.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 2fee68abb9..35705040d7 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1981,6 +1981,12 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
} else if (a.type == QInputMethodEvent::TextFormat) {
QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
if (f.isValid()) {
+ if (f.background().color().alphaF() == 1 && f.background().style() == Qt::SolidPattern) {
+ f.setForeground(f.background().color());
+ f.setBackground(Qt::transparent);
+ f.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ f.setFontUnderline(true);
+ }
QTextLayout::FormatRange o;
o.start = a.start + cursor.position() - block.position();
o.length = a.length;