summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-04-12 18:21:39 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-13 10:44:28 +0200
commit9fd2edb6da5f1f6d644cd7c3f35aebe3e88beee2 (patch)
treed644aeef68584469ec1b9b6cdbc3d86cc7ddf86b /src/widgets/widgets
parentb317fe2a606e5b79f24b1e4a1b808f5ff66d3621 (diff)
replace hardcoded values with a surrogate handling methods
Change-Id: Ib41e08d835f2e8ca2e32b4025c6f5a99840f2e27 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index c9300d3cdd..017cbee219 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -103,11 +103,11 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
int cursor = m_cursor - 1;
QChar uc = m_text.at(cursor);
str[cursor] = uc;
- if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ if (cursor > 0 && uc.isLowSurrogate()) {
// second half of a surrogate, check if we have the first half as well,
// if yes restore both at once
uc = m_text.at(cursor - 1);
- if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
+ if (uc.isHighSurrogate())
str[cursor - 1] = uc;
}
}
@@ -220,11 +220,11 @@ void QWidgetLineControl::backspace()
if (m_maskData)
m_cursor = prevMaskBlank(m_cursor);
QChar uc = m_text.at(m_cursor);
- if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ if (m_cursor > 0 && uc.isLowSurrogate()) {
// second half of a surrogate, check if we have the first half as well,
// if yes delete both at once
uc = m_text.at(m_cursor - 1);
- if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) {
+ if (uc.isHighSurrogate()) {
internalDelete(true);
--m_cursor;
}