From d17c76feee9eece4f7d9d1c5cec254842bb0a639 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Fri, 8 Jul 2011 18:24:57 +0400 Subject: drop an obsolete QChar::NoCategory enum value there is no such category in the Unicode specs. the QChar::NoCategory was a subject of bugs since it was introduced. int 4.6 it's meaning was limited to mention ucs4 > UNICODE_LAST_CODEPOINT only (which is useless anyways) in order to preserve the old (wrong) behavior. fix it now for qtbase Change-Id: I630534824e071090b39772881e747c1fdb758719 Reviewed-on: http://codereview.qt.nokia.com/1584 Reviewed-by: Lars Knoll --- dist/changes-5.0.0 | 2 ++ examples/widgets/charactermap/characterwidget.cpp | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-external.h | 2 -- src/corelib/tools/qchar.cpp | 4 +--- src/corelib/tools/qchar.h | 2 -- tests/auto/qchar/tst_qchar.cpp | 5 ++--- util/unicode/main.cpp | 7 ++----- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 4c226aa9d6..344edb6517 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -38,6 +38,8 @@ Third party components QtCore ------ +* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned + value is returned for an unassigned codepoints now. QtGui ----- diff --git a/examples/widgets/charactermap/characterwidget.cpp b/examples/widgets/charactermap/characterwidget.cpp index d9a59b68b2..7d515f4f38 100644 --- a/examples/widgets/charactermap/characterwidget.cpp +++ b/examples/widgets/charactermap/characterwidget.cpp @@ -120,7 +120,7 @@ void CharacterWidget::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { lastKey = (event->y()/squareSize)*columns + event->x()/squareSize; - if (QChar(lastKey).category() != QChar::NoCategory) + if (QChar(lastKey).category() != QChar::Other_NotAssigned) emit characterSelected(QString(QChar(lastKey))); update(); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-external.h b/src/3rdparty/harfbuzz/src/harfbuzz-external.h index 7644f0dd43..5fff35fe50 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-external.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-external.h @@ -52,8 +52,6 @@ typedef enum { typedef enum { - HB_NoCategory, - HB_Mark_NonSpacing, /* Mn */ HB_Mark_SpacingCombining, /* Mc */ HB_Mark_Enclosing, /* Me */ diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 475bd55de4..89f19b40e6 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -259,8 +259,6 @@ QT_BEGIN_NAMESPACE \value Symbol_Other Unicode class name So - \value NoCategory Qt cannot find an appropriate category for the character. - \omitvalue Punctuation_Dask \sa category() @@ -764,7 +762,7 @@ QChar::Category QChar::category() const QChar::Category QChar::category(uint ucs4) { if (ucs4 > UNICODE_LAST_CODEPOINT) - return QChar::NoCategory; + return QChar::Other_NotAssigned; return (QChar::Category) qGetProp(ucs4)->category; } diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index d6db72d5ac..277c2987ce 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -93,8 +93,6 @@ public: enum Category { - NoCategory, // ### Qt 5: replace with Other_NotAssigned - Mark_NonSpacing, // Mn Mark_SpacingCombining, // Mc Mark_Enclosing, // Me diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp index 1fdbc34eb9..02807f38b3 100644 --- a/tests/auto/qchar/tst_qchar.cpp +++ b/tests/auto/qchar/tst_qchar.cpp @@ -289,11 +289,10 @@ void tst_QChar::category() QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate); QVERIFY(QChar::category(0xdc01u) == QChar::Other_Surrogate); - QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse); - QVERIFY(QChar::category((uint)0x110000u) == QChar::NoCategory); - QVERIFY(QChar::category((uint)0x1aff) == QChar::Other_NotAssigned); + QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse); QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned); + QVERIFY(QChar::category((uint)0x110000u) == QChar::Other_NotAssigned); } void tst_QChar::direction() diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 4d43464455..e2596c799f 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -615,7 +615,7 @@ static void initCategoryMap() { QChar::Symbol_Currency, "Sc" }, { QChar::Symbol_Modifier, "Sk" }, { QChar::Symbol_Other, "So" }, - { QChar::NoCategory, 0 } + { QChar::Other_NotAssigned, 0 } }; Cat *c = categories; while (c->name) { @@ -763,10 +763,7 @@ static void readUnicodeData() } UnicodeData data(codepoint); - data.p.category = categoryMap.value(properties[UD_Category], QChar::NoCategory); - if (data.p.category == QChar::NoCategory) - qFatal("unassigned char category: %s", properties[UD_Category].constData()); - + data.p.category = categoryMap.value(properties[UD_Category], QChar::Other_NotAssigned); data.p.combiningClass = properties[UD_CombiningClass].toInt(); if (!combiningClassUsage.contains(data.p.combiningClass)) combiningClassUsage[data.p.combiningClass] = 1; -- cgit v1.2.3