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 <lars.knoll@nokia.com>
This commit is contained in:
parent
4a8d8055b4
commit
d17c76feee
2
dist/changes-5.0.0
vendored
2
dist/changes-5.0.0
vendored
@ -38,6 +38,8 @@ Third party components
|
|||||||
|
|
||||||
QtCore
|
QtCore
|
||||||
------
|
------
|
||||||
|
* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned
|
||||||
|
value is returned for an unassigned codepoints now.
|
||||||
|
|
||||||
QtGui
|
QtGui
|
||||||
-----
|
-----
|
||||||
|
@ -120,7 +120,7 @@ void CharacterWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
lastKey = (event->y()/squareSize)*columns + event->x()/squareSize;
|
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)));
|
emit characterSelected(QString(QChar(lastKey)));
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@ typedef enum {
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
HB_NoCategory,
|
|
||||||
|
|
||||||
HB_Mark_NonSpacing, /* Mn */
|
HB_Mark_NonSpacing, /* Mn */
|
||||||
HB_Mark_SpacingCombining, /* Mc */
|
HB_Mark_SpacingCombining, /* Mc */
|
||||||
HB_Mark_Enclosing, /* Me */
|
HB_Mark_Enclosing, /* Me */
|
||||||
|
@ -259,8 +259,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
\value Symbol_Other Unicode class name So
|
\value Symbol_Other Unicode class name So
|
||||||
|
|
||||||
\value NoCategory Qt cannot find an appropriate category for the character.
|
|
||||||
|
|
||||||
\omitvalue Punctuation_Dask
|
\omitvalue Punctuation_Dask
|
||||||
|
|
||||||
\sa category()
|
\sa category()
|
||||||
@ -764,7 +762,7 @@ QChar::Category QChar::category() const
|
|||||||
QChar::Category QChar::category(uint ucs4)
|
QChar::Category QChar::category(uint ucs4)
|
||||||
{
|
{
|
||||||
if (ucs4 > UNICODE_LAST_CODEPOINT)
|
if (ucs4 > UNICODE_LAST_CODEPOINT)
|
||||||
return QChar::NoCategory;
|
return QChar::Other_NotAssigned;
|
||||||
return (QChar::Category) qGetProp(ucs4)->category;
|
return (QChar::Category) qGetProp(ucs4)->category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,6 @@ public:
|
|||||||
|
|
||||||
enum Category
|
enum Category
|
||||||
{
|
{
|
||||||
NoCategory, // ### Qt 5: replace with Other_NotAssigned
|
|
||||||
|
|
||||||
Mark_NonSpacing, // Mn
|
Mark_NonSpacing, // Mn
|
||||||
Mark_SpacingCombining, // Mc
|
Mark_SpacingCombining, // Mc
|
||||||
Mark_Enclosing, // Me
|
Mark_Enclosing, // Me
|
||||||
|
@ -289,11 +289,10 @@ void tst_QChar::category()
|
|||||||
QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate);
|
QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate);
|
||||||
QVERIFY(QChar::category(0xdc01u) == 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)0x1aff) == QChar::Other_NotAssigned);
|
||||||
|
QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse);
|
||||||
QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned);
|
QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned);
|
||||||
|
QVERIFY(QChar::category((uint)0x110000u) == QChar::Other_NotAssigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QChar::direction()
|
void tst_QChar::direction()
|
||||||
|
@ -615,7 +615,7 @@ static void initCategoryMap()
|
|||||||
{ QChar::Symbol_Currency, "Sc" },
|
{ QChar::Symbol_Currency, "Sc" },
|
||||||
{ QChar::Symbol_Modifier, "Sk" },
|
{ QChar::Symbol_Modifier, "Sk" },
|
||||||
{ QChar::Symbol_Other, "So" },
|
{ QChar::Symbol_Other, "So" },
|
||||||
{ QChar::NoCategory, 0 }
|
{ QChar::Other_NotAssigned, 0 }
|
||||||
};
|
};
|
||||||
Cat *c = categories;
|
Cat *c = categories;
|
||||||
while (c->name) {
|
while (c->name) {
|
||||||
@ -763,10 +763,7 @@ static void readUnicodeData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnicodeData data(codepoint);
|
UnicodeData data(codepoint);
|
||||||
data.p.category = categoryMap.value(properties[UD_Category], QChar::NoCategory);
|
data.p.category = categoryMap.value(properties[UD_Category], QChar::Other_NotAssigned);
|
||||||
if (data.p.category == QChar::NoCategory)
|
|
||||||
qFatal("unassigned char category: %s", properties[UD_Category].constData());
|
|
||||||
|
|
||||||
data.p.combiningClass = properties[UD_CombiningClass].toInt();
|
data.p.combiningClass = properties[UD_CombiningClass].toInt();
|
||||||
if (!combiningClassUsage.contains(data.p.combiningClass))
|
if (!combiningClassUsage.contains(data.p.combiningClass))
|
||||||
combiningClassUsage[data.p.combiningClass] = 1;
|
combiningClassUsage[data.p.combiningClass] = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user