summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-08-20 17:19:26 +0200
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-09-02 16:13:12 +0200
commit942c6910d1bab87aebb258d4076386c00ce041ba (patch)
treee0b73e6d95b145b704befc1eab00c3318ff65022 /src/plugins/platforms/ios
parentfea21655a8b04553b438e866dfcccc5a3d6120a5 (diff)
iOS: Get rid of markedTextFormat global static variable in IME
Preperation for IME refactor. Change-Id: I0832c174d05d019d69ef7c01c45aaedc6e4d9468 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/quiview_textinput.mm21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/platforms/ios/quiview_textinput.mm b/src/plugins/platforms/ios/quiview_textinput.mm
index 2280b8259a..6b2707e706 100644
--- a/src/plugins/platforms/ios/quiview_textinput.mm
+++ b/src/plugins/platforms/ios/quiview_textinput.mm
@@ -49,19 +49,11 @@ class StaticVariables
public:
QInputMethodQueryEvent inputMethodQueryEvent;
bool inUpdateKeyboardLayout;
- QTextCharFormat markedTextFormat;
StaticVariables()
: inputMethodQueryEvent(Qt::ImQueryInput)
, inUpdateKeyboardLayout(false)
{
- // There seems to be no way to query how the preedit text
- // should be drawn. So we need to hard-code the color.
- QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
- if (iosVersion < QSysInfo::MV_IOS_7_0)
- markedTextFormat.setBackground(QColor(235, 239, 247));
- else
- markedTextFormat.setBackground(QColor(206, 221, 238));
}
};
@@ -301,8 +293,19 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
m_markedText = markedText ? QString::fromNSString(markedText) : QString();
+ static QTextCharFormat markedTextFormat;
+ if (markedTextFormat.isEmpty()) {
+ // There seems to be no way to query how the preedit text
+ // should be drawn. So we need to hard-code the color.
+ QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
+ if (iosVersion < QSysInfo::MV_IOS_7_0)
+ markedTextFormat.setBackground(QColor(235, 239, 247));
+ else
+ markedTextFormat.setBackground(QColor(206, 221, 238));
+ }
+
QList<QInputMethodEvent::Attribute> attrs;
- attrs << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, markedText.length, staticVariables()->markedTextFormat);
+ attrs << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, markedText.length, markedTextFormat);
QInputMethodEvent e(m_markedText, attrs);
[self sendEventToFocusObject:e];
}