QChar Class
The QChar class provides a 16-bit Unicode character. More...
Header: | #include <QChar> |
qmake: | QT += core |
Note: All functions in this class are reentrant.
Public Types
enum | Category { Mark_NonSpacing, Mark_SpacingCombining, Mark_Enclosing, Number_DecimalDigit, Number_Letter, …, Symbol_Other } |
enum | Decomposition { NoDecomposition, Canonical, Circle, Compat, Final, …, Wide } |
enum | Direction { DirAL, DirAN, DirB, DirBN, DirCS, …, DirWS } |
enum | JoiningType { Joining_None, Joining_Causing, Joining_Dual, Joining_Right, Joining_Left, Joining_Transparent } |
enum | Script { Script_Unknown, Script_Inherited, Script_Common, Script_Latin, Script_Greek, …, Script_ZanabazarSquare } |
enum | SpecialCharacter { Null, Tabulation, LineFeed, FormFeed, CarriageReturn, …, LastValidCodePoint } |
enum | UnicodeVersion { Unicode_1_1, Unicode_2_0, Unicode_2_1_2, Unicode_3_0, Unicode_3_1, …, Unicode_Unassigned } |
Public Functions
QChar(uchar ch) | |
QChar(char ch) | |
QChar(wchar_t ch) | |
QChar(char16_t ch) | |
QChar(QLatin1Char ch) | |
QChar(QChar::SpecialCharacter ch) | |
QChar(int code) | |
QChar(uint code) | |
QChar(short code) | |
QChar(uchar cell, uchar row) | |
QChar(ushort code) | |
QChar() | |
QChar::Category | category() const |
uchar | cell() const |
unsigned char | combiningClass() const |
QString | decomposition() const |
QChar::Decomposition | decompositionTag() const |
int | digitValue() const |
QChar::Direction | direction() const |
bool | hasMirrored() const |
bool | isDigit() const |
bool | isHighSurrogate() const |
bool | isLetter() const |
bool | isLetterOrNumber() const |
bool | isLowSurrogate() const |
bool | isLower() const |
bool | isMark() const |
bool | isNonCharacter() const |
bool | isNull() const |
bool | isNumber() const |
bool | isPrint() const |
bool | isPunct() const |
bool | isSpace() const |
bool | isSurrogate() const |
bool | isSymbol() const |
bool | isTitleCase() const |
bool | isUpper() const |
QChar::JoiningType | joiningType() const |
QChar | mirroredChar() const |
uchar | row() const |
QChar::Script | script() const |
QChar | toCaseFolded() const |
char | toLatin1() const |
QChar | toLower() const |
QChar | toTitleCase() const |
QChar | toUpper() const |
ushort | unicode() const |
ushort & | unicode() |
QChar::UnicodeVersion | unicodeVersion() const |
Static Public Members
QChar::Category | category(uint ucs4) |
unsigned char | combiningClass(uint ucs4) |
QChar::UnicodeVersion | currentUnicodeVersion() |
QString | decomposition(uint ucs4) |
QChar::Decomposition | decompositionTag(uint ucs4) |
int | digitValue(uint ucs4) |
QChar::Direction | direction(uint ucs4) |
QChar | fromLatin1(char c) |
bool | hasMirrored(uint ucs4) |
ushort | highSurrogate(uint ucs4) |
bool | isDigit(uint ucs4) |
bool | isHighSurrogate(uint ucs4) |
bool | isLetter(uint ucs4) |
bool | isLetterOrNumber(uint ucs4) |
bool | isLowSurrogate(uint ucs4) |
bool | isLower(uint ucs4) |
bool | isMark(uint ucs4) |
bool | isNonCharacter(uint ucs4) |
bool | isNumber(uint ucs4) |
bool | isPrint(uint ucs4) |
bool | isPunct(uint ucs4) |
bool | isSpace(uint ucs4) |
bool | isSurrogate(uint ucs4) |
bool | isSymbol(uint ucs4) |
bool | isTitleCase(uint ucs4) |
bool | isUpper(uint ucs4) |
QChar::JoiningType | joiningType(uint ucs4) |
ushort | lowSurrogate(uint ucs4) |
uint | mirroredChar(uint ucs4) |
bool | requiresSurrogates(uint ucs4) |
QChar::Script | script(uint ucs4) |
uint | surrogateToUcs4(ushort high, ushort low) |
uint | surrogateToUcs4(QChar high, QChar low) |
uint | toCaseFolded(uint ucs4) |
uint | toLower(uint ucs4) |
uint | toTitleCase(uint ucs4) |
uint | toUpper(uint ucs4) |
QChar::UnicodeVersion | unicodeVersion(uint ucs4) |
Related Non-Members
bool | operator!=(QChar c1, QChar c2) |
bool | operator<(QChar c1, QChar c2) |
QDataStream & | operator<<(QDataStream &out, QChar chr) |
bool | operator<=(QChar c1, QChar c2) |
bool | operator==(QChar c1, QChar c2) |
bool | operator>(QChar c1, QChar c2) |
bool | operator>=(QChar c1, QChar c2) |
QDataStream & | operator>>(QDataStream &in, QChar &chr) |
Detailed Description
In Qt, Unicode characters are 16-bit entities without any markup or structure. This class represents such an entity. It is lightweight, so it can be used everywhere. Most compilers treat it like an unsigned short
.
QChar provides a full complement of testing/classification functions, converting to and from other formats, converting from composed to decomposed Unicode, and trying to compare and case-convert if you ask it to.
The classification functions include functions like those in the standard C++ header <cctype> (formerly <ctype.h>), but operating on the full range of Unicode characters, not just for the ASCII range. They all return true if the character is a certain type of character; otherwise they return false. These classification functions are isNull() (returns true
if the character is '\0'), isPrint() (true if the character is any sort of printable character, including whitespace), isPunct() (any sort of punctation), isMark() (Unicode Mark), isLetter() (a letter), isNumber() (any sort of numeric character, not just 0-9), isLetterOrNumber(), and isDigit() (decimal digits). All of these are wrappers around category() which return the Unicode-defined category of each character. Some of these also calculate the derived properties (for example isSpace() returns true
if the character is of category Separator_* or an exceptional code point from Other_Control category).
QChar also provides direction(), which indicates the "natural" writing direction of this character. The joiningType() function indicates how the character joins with it's neighbors (needed mostly for Arabic or Syriac) and finally hasMirrored(), which indicates whether the character needs to be mirrored when it is printed in it's "unnatural" writing direction.
Composed Unicode characters (like ring) can be converted to decomposed Unicode ("a" followed by "ring above") by using decomposition().
In Unicode, comparison is not necessarily possible and case conversion is very difficult at best. Unicode, covering the "entire" world, also includes most of the world's case and sorting problems. operator==() and friends will do comparison based purely on the numeric Unicode value (code point) of the characters, and toUpper() and toLower() will do case changes when the character has a well-defined uppercase/lowercase equivalent. For locale-dependent comparisons, use QString::localeAwareCompare().
The conversion functions include unicode() (to a scalar), toLatin1() (to scalar, but converts all non-Latin-1 characters to 0), row() (gives the Unicode row), cell() (gives the Unicode cell), digitValue() (gives the integer value of any of the numerous digit characters), and a host of constructors.
QChar provides constructors and cast operators that make it easy to convert to and from traditional 8-bit char
s. If you defined QT_NO_CAST_FROM_ASCII
and QT_NO_CAST_TO_ASCII
, as explained in the QString documentation, you will need to explicitly call fromLatin1(), or use QLatin1Char, to construct a QChar from an 8-bit char
, and you will need to call toLatin1() to get the 8-bit value back.
For more information see "About the Unicode Character Database".
See also Unicode, QString, and QLatin1Char.
Member Type Documentation
enum QChar::Category
This enum maps the Unicode character categories.
The following characters are normative in Unicode:
Constant | Value | Description |
---|---|---|
QChar::Mark_NonSpacing | 0 | Unicode class name Mn |
QChar::Mark_SpacingCombining | 1 | Unicode class name Mc |
QChar::Mark_Enclosing | 2 | Unicode class name Me |
QChar::Number_DecimalDigit | 3 | Unicode class name Nd |
QChar::Number_Letter | 4 | Unicode class name Nl |
QChar::Number_Other | 5 | Unicode class name No |
QChar::Separator_Space | 6 | Unicode class name Zs |
QChar::Separator_Line | 7 | Unicode class name Zl |
QChar::Separator_Paragraph | 8 | Unicode class name Zp |
QChar::Other_Control | 9 | Unicode class name Cc |
QChar::Other_Format | 10 | Unicode class name Cf |
QChar::Other_Surrogate | 11 | Unicode class name Cs |
QChar::Other_PrivateUse | 12 | Unicode class name Co |
QChar::Other_NotAssigned | 13 | Unicode class name Cn |
The following categories are informative in Unicode:
Constant | Value | Description |
---|---|---|
QChar::Letter_Uppercase | 14 | Unicode class name Lu |
QChar::Letter_Lowercase | 15 | Unicode class name Ll |
QChar::Letter_Titlecase | 16 | Unicode class name Lt |
QChar::Letter_Modifier | 17 | Unicode class name Lm |
QChar::Letter_Other | 18 | Unicode class name Lo |
QChar::Punctuation_Connector | 19 | Unicode class name Pc |
QChar::Punctuation_Dash | 20 | Unicode class name Pd |
QChar::Punctuation_Open | 21 | Unicode class name Ps |
QChar::Punctuation_Close | 22 | Unicode class name Pe |
QChar::Punctuation_InitialQuote | 23 | Unicode class name Pi |
QChar::Punctuation_FinalQuote | 24 | Unicode class name Pf |
QChar::Punctuation_Other | 25 | Unicode class name Po |
QChar::Symbol_Math | 26 | Unicode class name Sm |
QChar::Symbol_Currency | 27 | Unicode class name Sc |
QChar::Symbol_Modifier | 28 | Unicode class name Sk |
QChar::Symbol_Other | 29 | Unicode class name So |
See also category().
enum QChar::Decomposition
This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.
Constant | Value |
---|---|
QChar::NoDecomposition | 0 |
QChar::Canonical | 1 |
QChar::Circle | 8 |
QChar::Compat | 16 |
QChar::Final | 6 |
QChar::Font | 2 |
QChar::Fraction | 17 |
QChar::Initial | 4 |
QChar::Isolated | 7 |
QChar::Medial | 5 |
QChar::Narrow | 13 |
QChar::NoBreak | 3 |
QChar::Small | 14 |
QChar::Square | 15 |
QChar::Sub | 10 |
QChar::Super | 9 |
QChar::Vertical | 11 |
QChar::Wide | 12 |
See also decomposition().
enum QChar::Direction
This enum type defines the Unicode direction attributes. See the Unicode Standard for a description of the values.
In order to conform to C/C++ naming conventions "Dir" is prepended to the codes used in the Unicode Standard.
Constant | Value | Description |
---|---|---|
QChar::DirAL | 13 | Â |
QChar::DirAN | 5 | Â |
QChar::DirB | 7 | Â |
QChar::DirBN | 18 | Â |
QChar::DirCS | 6 | Â |
QChar::DirEN | 2 | Â |
QChar::DirES | 3 | Â |
QChar::DirET | 4 | Â |
QChar::DirFSI | 21 | Since Qt 5.3 |
QChar::DirL | 0 | Â |
QChar::DirLRE | 11 | Â |
QChar::DirLRI | 19 | Since Qt 5.3 |
QChar::DirLRO | 12 | Â |
QChar::DirNSM | 17 | Â |
QChar::DirON | 10 | Â |
QChar::DirPDF | 16 | Â |
QChar::DirPDI | 22 | Since Qt 5.3 |
QChar::DirR | 1 | Â |
QChar::DirRLE | 14 | Â |
QChar::DirRLI | 20 | Since Qt 5.3 |
QChar::DirRLO | 15 | Â |
QChar::DirS | 8 | Â |
QChar::DirWS | 9 | Â |
See also direction().
enum QChar::JoiningType
since 5.3
This enum type defines the Unicode joining type attributes. See the Unicode Standard for a description of the values.
In order to conform to C/C++ naming conventions "Joining_" is prepended to the codes used in the Unicode Standard.
Constant | Value |
---|---|
QChar::Joining_None | 0 |
QChar::Joining_Causing | 1 |
QChar::Joining_Dual | 2 |
QChar::Joining_Right | 3 |
QChar::Joining_Left | 4 |
QChar::Joining_Transparent | 5 |
See also joiningType().
enum QChar::Script
This enum type defines the Unicode script property values.
For details about the Unicode script property values see Unicode Standard Annex #24.
In order to conform to C/C++ naming conventions "Script_" is prepended to the codes used in the Unicode Standard.
Constant | Value | Description |
---|---|---|
QChar::Script_Unknown | 0 | For unassigned, private-use, noncharacter, and surrogate code points. |
QChar::Script_Inherited | 1 | For characters that may be used with multiple scripts and that inherit their script from the preceding characters. These include nonspacing marks, enclosing marks, and zero width joiner/non-joiner characters. |
QChar::Script_Common | 2 | For characters that may be used with multiple scripts and that do not inherit their script from the preceding characters. |
QChar::Script_Latin | 3 | Â |
QChar::Script_Greek | 4 | Â |
QChar::Script_Cyrillic | 5 | Â |
QChar::Script_Armenian | 6 | Â |
QChar::Script_Hebrew | 7 | Â |
QChar::Script_Arabic | 8 | Â |
QChar::Script_Syriac | 9 | Â |
QChar::Script_Thaana | 10 | Â |
QChar::Script_Devanagari | 11 | Â |
QChar::Script_Bengali | 12 | Â |
QChar::Script_Gurmukhi | 13 | Â |
QChar::Script_Gujarati | 14 | Â |
QChar::Script_Oriya | 15 | Â |
QChar::Script_Tamil | 16 | Â |
QChar::Script_Telugu | 17 | Â |
QChar::Script_Kannada | 18 | Â |
QChar::Script_Malayalam | 19 | Â |
QChar::Script_Sinhala | 20 | Â |
QChar::Script_Thai | 21 | Â |
QChar::Script_Lao | 22 | Â |
QChar::Script_Tibetan | 23 | Â |
QChar::Script_Myanmar | 24 | Â |
QChar::Script_Georgian | 25 | Â |
QChar::Script_Hangul | 26 | Â |
QChar::Script_Ethiopic | 27 | Â |
QChar::Script_Cherokee | 28 | Â |
QChar::Script_CanadianAboriginal | 29 | Â |
QChar::Script_Ogham | 30 | Â |
QChar::Script_Runic | 31 | Â |
QChar::Script_Khmer | 32 | Â |
QChar::Script_Mongolian | 33 | Â |
QChar::Script_Hiragana | 34 | Â |
QChar::Script_Katakana | 35 | Â |
QChar::Script_Bopomofo | 36 | Â |
QChar::Script_Han | 37 | Â |
QChar::Script_Yi | 38 | Â |
QChar::Script_OldItalic | 39 | Â |
QChar::Script_Gothic | 40 | Â |
QChar::Script_Deseret | 41 | Â |
QChar::Script_Tagalog | 42 | Â |
QChar::Script_Hanunoo | 43 | Â |
QChar::Script_Buhid | 44 | Â |
QChar::Script_Tagbanwa | 45 | Â |
QChar::Script_Coptic | 46 | Â |
QChar::Script_Limbu | 47 | Â |
QChar::Script_TaiLe | 48 | Â |
QChar::Script_LinearB | 49 | Â |
QChar::Script_Ugaritic | 50 | Â |
QChar::Script_Shavian | 51 | Â |
QChar::Script_Osmanya | 52 | Â |
QChar::Script_Cypriot | 53 | Â |
QChar::Script_Braille | 54 | Â |
QChar::Script_Buginese | 55 | Â |
QChar::Script_NewTaiLue | 56 | Â |
QChar::Script_Glagolitic | 57 | Â |
QChar::Script_Tifinagh | 58 | Â |
QChar::Script_SylotiNagri | 59 | Â |
QChar::Script_OldPersian | 60 | Â |
QChar::Script_Kharoshthi | 61 | Â |
QChar::Script_Balinese | 62 | Â |
QChar::Script_Cuneiform | 63 | Â |
QChar::Script_Phoenician | 64 | Â |
QChar::Script_PhagsPa | 65 | Â |
QChar::Script_Nko | 66 | Â |
QChar::Script_Sundanese | 67 | Â |
QChar::Script_Lepcha | 68 | Â |
QChar::Script_OlChiki | 69 | Â |
QChar::Script_Vai | 70 | Â |
QChar::Script_Saurashtra | 71 | Â |
QChar::Script_KayahLi | 72 | Â |
QChar::Script_Rejang | 73 | Â |
QChar::Script_Lycian | 74 | Â |
QChar::Script_Carian | 75 | Â |
QChar::Script_Lydian | 76 | Â |
QChar::Script_Cham | 77 | Â |
QChar::Script_TaiTham | 78 | Â |
QChar::Script_TaiViet | 79 | Â |
QChar::Script_Avestan | 80 | Â |
QChar::Script_EgyptianHieroglyphs | 81 | Â |
QChar::Script_Samaritan | 82 | Â |
QChar::Script_Lisu | 83 | Â |
QChar::Script_Bamum | 84 | Â |
QChar::Script_Javanese | 85 | Â |
QChar::Script_MeeteiMayek | 86 | Â |
QChar::Script_ImperialAramaic | 87 | Â |
QChar::Script_OldSouthArabian | 88 | Â |
QChar::Script_InscriptionalParthian | 89 | Â |
QChar::Script_InscriptionalPahlavi | 90 | Â |
QChar::Script_OldTurkic | 91 | Â |
QChar::Script_Kaithi | 92 | Â |
QChar::Script_Batak | 93 | Â |
QChar::Script_Brahmi | 94 | Â |
QChar::Script_Mandaic | 95 | Â |
QChar::Script_Chakma | 96 | Â |
QChar::Script_MeroiticCursive | 97 | Â |
QChar::Script_MeroiticHieroglyphs | 98 | Â |
QChar::Script_Miao | 99 | Â |
QChar::Script_Sharada | 100 | Â |
QChar::Script_SoraSompeng | 101 | Â |
QChar::Script_Takri | 102 | Â |
QChar::Script_CaucasianAlbanian | 103 | Â |
QChar::Script_BassaVah | 104 | Â |
QChar::Script_Duployan | 105 | Â |
QChar::Script_Elbasan | 106 | Â |
QChar::Script_Grantha | 107 | Â |
QChar::Script_PahawhHmong | 108 | Â |
QChar::Script_Khojki | 109 | Â |
QChar::Script_LinearA | 110 | Â |
QChar::Script_Mahajani | 111 | Â |
QChar::Script_Manichaean | 112 | Â |
QChar::Script_MendeKikakui | 113 | Â |
QChar::Script_Modi | 114 | Â |
QChar::Script_Mro | 115 | Â |
QChar::Script_OldNorthArabian | 116 | Â |
QChar::Script_Nabataean | 117 | Â |
QChar::Script_Palmyrene | 118 | Â |
QChar::Script_PauCinHau | 119 | Â |
QChar::Script_OldPermic | 120 | Â |
QChar::Script_PsalterPahlavi | 121 | Â |
QChar::Script_Siddham | 122 | Â |
QChar::Script_Khudawadi | 123 | Â |
QChar::Script_Tirhuta | 124 | Â |
QChar::Script_WarangCiti | 125 | Â |
QChar::Script_Ahom | 126 | Â |
QChar::Script_AnatolianHieroglyphs | 127 | Â |
QChar::Script_Hatran | 128 | Â |
QChar::Script_Multani | 129 | Â |
QChar::Script_OldHungarian | 130 | Â |
QChar::Script_SignWriting | 131 | Â |
QChar::Script_Adlam | 132 | Â |
QChar::Script_Bhaiksuki | 133 | Â |
QChar::Script_Marchen | 134 | Â |
QChar::Script_Newa | 135 | Â |
QChar::Script_Osage | 136 | Â |
QChar::Script_Tangut | 137 | Â |
QChar::Script_MasaramGondi | 138 | Â |
QChar::Script_Nushu | 139 | Â |
QChar::Script_Soyombo | 140 | Â |
QChar::Script_ZanabazarSquare | 141 | Â |
This enum was introduced or modified in Qt 5.1.
See also script().
enum QChar::SpecialCharacter
Constant | Value | Description |
---|---|---|
QChar::Null | 0x0000 | A QChar with this value isNull(). |
QChar::Tabulation | 0x0009 | Character tabulation. |
QChar::LineFeed | 0x000a | Â |
QChar::FormFeed | 0x000c | Â |
QChar::CarriageReturn | 0x000d | Â |
QChar::Space | 0x0020 | Â |
QChar::Nbsp | 0x00a0 | Non-breaking space. |
QChar::SoftHyphen | 0x00ad | Â |
QChar::ReplacementCharacter | 0xfffd | The character shown when a font has no glyph for a certain codepoint. A special question mark character is often used. Codecs use this codepoint when input data cannot be represented in Unicode. |
QChar::ObjectReplacementCharacter | 0xfffc | Used to represent an object such as an image when such objects cannot be presented. |
QChar::ByteOrderMark | 0xfeff | Â |
QChar::ByteOrderSwapped | 0xfffe | Â |
QChar::ParagraphSeparator | 0x2029 | Â |
QChar::LineSeparator | 0x2028 | Â |
QChar::LastValidCodePoint | 0x10ffff | Â |
enum QChar::UnicodeVersion
Specifies which version of the Unicode standard introduced a certain character.
Constant | Value | Description |
---|---|---|
QChar::Unicode_1_1 | 1 | Version 1.1 |
QChar::Unicode_2_0 | 2 | Version 2.0 |
QChar::Unicode_2_1_2 | 3 | Version 2.1.2 |
QChar::Unicode_3_0 | 4 | Version 3.0 |
QChar::Unicode_3_1 | 5 | Version 3.1 |
QChar::Unicode_3_2 | 6 | Version 3.2 |
QChar::Unicode_4_0 | 7 | Version 4.0 |
QChar::Unicode_4_1 | 8 | Version 4.1 |
QChar::Unicode_5_0 | 9 | Version 5.0 |
QChar::Unicode_5_1 | 10 | Version 5.1 |
QChar::Unicode_5_2 | 11 | Version 5.2 |
QChar::Unicode_6_0 | 12 | Version 6.0 |
QChar::Unicode_6_1 | 13 | Version 6.1 |
QChar::Unicode_6_2 | 14 | Version 6.2 |
QChar::Unicode_6_3 | 15 | Version 6.3 Since Qt 5.3 |
QChar::Unicode_7_0 | 16 | Version 7.0 Since Qt 5.5 |
QChar::Unicode_8_0 | 17 | Version 8.0 Since Qt 5.6 |
QChar::Unicode_9_0 | 18 | Version 9.0 Since Qt 5.11 |
QChar::Unicode_10_0 | 19 | Version 10.0 Since Qt 5.11 |
QChar::Unicode_Unassigned | 0 | The value is not assigned to any character in version 8.0 of Unicode. |
See also unicodeVersion() and currentUnicodeVersion().
Member Function Documentation
QChar::QChar(uchar ch)
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
Note: This constructor is not available when QT_NO_CAST_FROM_ASCII
or QT_RESTRICTED_CAST_FROM_ASCII
is defined.
See also QT_NO_CAST_FROM_ASCII and QT_RESTRICTED_CAST_FROM_ASCII.
QChar::QChar(char ch)
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
Note: This constructor is not available when QT_NO_CAST_FROM_ASCII
is defined.
See also QT_NO_CAST_FROM_ASCII.
QChar::QChar(wchar_t ch)
Constructs a QChar corresponding to the wide character ch.
Note: This constructor is only available on Windows.
This function was introduced in Qt 5.10.
QChar::QChar(char16_t ch)
Constructs a QChar corresponding to the UTF-16 character ch.
This function was introduced in Qt 5.10.
QChar::QChar(QLatin1Char ch)
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
QChar::QChar(QChar::SpecialCharacter ch)
Constructs a QChar for the predefined character value ch.
QChar::QChar(int code)
Constructs a QChar for the character with Unicode code point code.
QChar::QChar(uint code)
Constructs a QChar for the character with Unicode code point code.
QChar::QChar(short code)
Constructs a QChar for the character with Unicode code point code.
QChar::QChar(uchar cell, uchar row)
Constructs a QChar for Unicode cell cell in row row.
QChar::QChar(ushort code)
Constructs a QChar for the character with Unicode code point code.
QChar::QChar()
Constructs a null QChar ('\0').
See also isNull().
QChar::Category QChar::category() const
Returns the character's category.
[static]
QChar::Category QChar::category(uint ucs4)
This is an overloaded function.
Returns the category of the UCS-4-encoded character specified by ucs4.
uchar QChar::cell() const
Returns the cell (least significant byte) of the Unicode character.
See also row().
unsigned char QChar::combiningClass() const
Returns the combining class for the character as defined in the Unicode standard. This is mainly useful as a positioning hint for marks attached to a base character.
The Qt text rendering engine uses this information to correctly position non-spacing marks around a base character.
[static]
unsigned char QChar::combiningClass(uint ucs4)
This is an overloaded function.
Returns the combining class for the UCS-4-encoded character specified by ucs4, as defined in the Unicode standard.
[static]
QChar::UnicodeVersion QChar::currentUnicodeVersion()
Returns the most recent supported Unicode version.
QString QChar::decomposition() const
Decomposes a character into it's constituent parts. Returns an empty string if no decomposition exists.
[static]
QString QChar::decomposition(uint ucs4)
This is an overloaded function.
Decomposes the UCS-4-encoded character specified by ucs4 into it's constituent parts. Returns an empty string if no decomposition exists.
QChar::Decomposition QChar::decompositionTag() const
Returns the tag defining the composition of the character. Returns QChar::NoDecomposition if no decomposition exists.
[static]
QChar::Decomposition QChar::decompositionTag(uint ucs4)
This is an overloaded function.
Returns the tag defining the composition of the UCS-4-encoded character specified by ucs4. Returns QChar::NoDecomposition if no decomposition exists.
int QChar::digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
[static]
int QChar::digitValue(uint ucs4)
This is an overloaded function.
Returns the numeric value of the digit specified by the UCS-4-encoded character, ucs4, or -1 if the character is not a digit.
QChar::Direction QChar::direction() const
Returns the character's direction.
[static]
QChar::Direction QChar::direction(uint ucs4)
This is an overloaded function.
Returns the direction of the UCS-4-encoded character specified by ucs4.
[static]
QChar QChar::fromLatin1(char c)
Converts the Latin-1 character c to its equivalent QChar. This is mainly useful for non-internationalized software.
An alternative is to use QLatin1Char.
See also toLatin1() and unicode().
bool QChar::hasMirrored() const
Returns true
if the character should be reversed if the text direction is reversed; otherwise returns false
.
A bit faster equivalent of (ch.mirroredChar() != ch).
See also mirroredChar().
[static]
bool QChar::hasMirrored(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 should be reversed if the text direction is reversed; otherwise returns false
.
A bit faster equivalent of (QChar::mirroredChar(ucs4) != ucs4).
This function was introduced in Qt 5.0.
See also mirroredChar().
[static]
ushort QChar::highSurrogate(uint ucs4)
Returns the high surrogate part of a UCS-4-encoded code point. The returned result is undefined if ucs4 is smaller than 0x10000.
bool QChar::isDigit() const
Returns true
if the character is a decimal digit (Number_DecimalDigit); otherwise returns false
.
See also isNumber().
[static]
bool QChar::isDigit(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a decimal digit (Number_DecimalDigit); otherwise returns false
.
This function was introduced in Qt 5.0.
See also isNumber().
bool QChar::isHighSurrogate() const
Returns true
if the QChar is the high part of a UTF16 surrogate (for example if its code point is in range [0xd800..0xdbff]); false otherwise.
[static]
bool QChar::isHighSurrogate(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is the high part of a UTF16 surrogate (for example if its code point is in range [0xd800..0xdbff]); false otherwise.
bool QChar::isLetter() const
Returns true
if the character is a letter (Letter_* categories); otherwise returns false
.
[static]
bool QChar::isLetter(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a letter (Letter_* categories); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isLetterOrNumber() const
Returns true
if the character is a letter or number (Letter_* or Number_* categories); otherwise returns false
.
[static]
bool QChar::isLetterOrNumber(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a letter or number (Letter_* or Number_* categories); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isLowSurrogate() const
Returns true
if the QChar is the low part of a UTF16 surrogate (for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
[static]
bool QChar::isLowSurrogate(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is the low part of a UTF16 surrogate (for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
bool QChar::isLower() const
Returns true
if the character is a lowercase letter, for example category() is Letter_Lowercase.
See also isUpper(), toLower(), and toUpper().
[static]
bool QChar::isLower(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a lowercase letter, for example category() is Letter_Lowercase.
This function was introduced in Qt 5.0.
See also isUpper(), toLower(), and toUpper().
bool QChar::isMark() const
Returns true
if the character is a mark (Mark_* categories); otherwise returns false
.
See QChar::Category for more information regarding marks.
[static]
bool QChar::isMark(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a mark (Mark_* categories); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isNonCharacter() const
Returns true
if the QChar is a non-character; false otherwise.
Unicode has a certain number of code points that are classified as "non-characters:" that is, they can be used for internal purposes in applications but cannot be used for text interchange. Those are the last two entries each Unicode Plane ([0xfffe..0xffff], [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef].
This function was introduced in Qt 5.0.
[static]
bool QChar::isNonCharacter(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a non-character; false otherwise.
Unicode has a certain number of code points that are classified as "non-characters:" that is, they can be used for internal purposes in applications but cannot be used for text interchange. Those are the last two entries each Unicode Plane ([0xfffe..0xffff], [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef].
This function was introduced in Qt 5.0.
bool QChar::isNull() const
Returns true
if the character is the Unicode character 0x0000 ('\0'); otherwise returns false
.
bool QChar::isNumber() const
Returns true
if the character is a number (Number_* categories, not just 0-9); otherwise returns false
.
See also isDigit().
[static]
bool QChar::isNumber(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a number (Number_* categories, not just 0-9); otherwise returns false
.
This function was introduced in Qt 5.0.
See also isDigit().
bool QChar::isPrint() const
Returns true
if the character is a printable character; otherwise returns false
. This is any character not of category Other_*.
Note that this gives no indication of whether the character is available in a particular font.
[static]
bool QChar::isPrint(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a printable character; otherwise returns false
. This is any character not of category Other_*.
Note that this gives no indication of whether the character is available in a particular font.
This function was introduced in Qt 5.0.
bool QChar::isPunct() const
Returns true
if the character is a punctuation mark (Punctuation_* categories); otherwise returns false
.
[static]
bool QChar::isPunct(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a punctuation mark (Punctuation_* categories); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isSpace() const
Returns true
if the character is a separator character (Separator_* categories or certain code points from Other_Control category); otherwise returns false
.
[static]
bool QChar::isSpace(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a separator character (Separator_* categories or certain code points from Other_Control category); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isSurrogate() const
Returns true
if the QChar contains a code point that is in either the high or the low part of the UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]); false otherwise.
This function was introduced in Qt 5.0.
[static]
bool QChar::isSurrogate(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 contains a code point that is in either the high or the low part of the UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]); false otherwise.
This function was introduced in Qt 5.0.
bool QChar::isSymbol() const
Returns true
if the character is a symbol (Symbol_* categories); otherwise returns false
.
[static]
bool QChar::isSymbol(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a symbol (Symbol_* categories); otherwise returns false
.
This function was introduced in Qt 5.0.
bool QChar::isTitleCase() const
Returns true
if the character is a titlecase letter, for example category() is Letter_Titlecase.
See also isLower(), toUpper(), toLower(), and toTitleCase().
[static]
bool QChar::isTitleCase(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is a titlecase letter, for example category() is Letter_Titlecase.
This function was introduced in Qt 5.0.
See also isLower(), toUpper(), toLower(), and toTitleCase().
bool QChar::isUpper() const
Returns true
if the character is an uppercase letter, for example category() is Letter_Uppercase.
See also isLower(), toUpper(), and toLower().
[static]
bool QChar::isUpper(uint ucs4)
This is an overloaded function.
Returns true
if the UCS-4-encoded character specified by ucs4 is an uppercase letter, for example category() is Letter_Uppercase.
This function was introduced in Qt 5.0.
See also isLower(), toUpper(), and toLower().
QChar::JoiningType QChar::joiningType() const
Returns information about the joining type attributes of the character (needed for certain languages such as Arabic or Syriac).
This function was introduced in Qt 5.3.
[static]
QChar::JoiningType QChar::joiningType(uint ucs4)
This is an overloaded function.
Returns information about the joining type attributes of the UCS-4-encoded character specified by ucs4 (needed for certain languages such as Arabic or Syriac).
This function was introduced in Qt 5.3.
[static]
ushort QChar::lowSurrogate(uint ucs4)
Returns the low surrogate part of a UCS-4-encoded code point. The returned result is undefined if ucs4 is smaller than 0x10000.
QChar QChar::mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the character itself.
See also hasMirrored().
[static]
uint QChar::mirroredChar(uint ucs4)
This is an overloaded function.
Returns the mirrored character if the UCS-4-encoded character specified by ucs4 is a mirrored character; otherwise returns the character itself.
See also hasMirrored().
[static]
bool QChar::requiresSurrogates(uint ucs4)
Returns true
if the UCS-4-encoded character specified by ucs4 can be split into the high and low parts of a UTF16 surrogate (for example if its code point is greater than or equals to 0x10000); false otherwise.
uchar QChar::row() const
Returns the row (most significant byte) of the Unicode character.
See also cell().
QChar::Script QChar::script() const
Returns the Unicode script property value for this character.
This function was introduced in Qt 5.1.
[static]
QChar::Script QChar::script(uint ucs4)
This is an overloaded function.
Returns the Unicode script property value for the character specified in its UCS-4-encoded form as ucs4.
This function was introduced in Qt 5.1.
[static]
uint QChar::surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to it's UCS-4-encoded code point.
[static]
uint QChar::surrogateToUcs4(QChar high, QChar low)
This is an overloaded function.
Converts a UTF16 surrogate pair (high, low) to it's UCS-4-encoded code point.
QChar QChar::toCaseFolded() const
Returns the case folded equivalent of the character. For most Unicode characters this is the same as toLower().
[static]
uint QChar::toCaseFolded(uint ucs4)
This is an overloaded function.
Returns the case folded equivalent of the UCS-4-encoded character specified by ucs4. For most Unicode characters this is the same as toLower().
char QChar::toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.
Note: It is not possible to distinguish a non-Latin-1 character from a Latin-1 0 (NUL) character. Prefer to use unicode(), which does not have this ambiguity.
See also unicode().
QChar QChar::toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the character itself.
[static]
uint QChar::toLower(uint ucs4)
This is an overloaded function.
Returns the lowercase equivalent of the UCS-4-encoded character specified by ucs4 if the character is uppercase or titlecase; otherwise returns the character itself.
QChar QChar::toTitleCase() const
Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the character itself.
[static]
uint QChar::toTitleCase(uint ucs4)
This is an overloaded function.
Returns the title case equivalent of the UCS-4-encoded character specified by ucs4 if the character is lowercase or uppercase; otherwise returns the character itself.
QChar QChar::toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the character itself.
[static]
uint QChar::toUpper(uint ucs4)
This is an overloaded function.
Returns the uppercase equivalent of the UCS-4-encoded character specified by ucs4 if the character is lowercase or titlecase; otherwise returns the character itself.
ushort QChar::unicode() const
Returns the numeric Unicode value of the QChar.
ushort &QChar::unicode()
Returns a reference to the numeric Unicode value of the QChar.
QChar::UnicodeVersion QChar::unicodeVersion() const
Returns the Unicode version that introduced this character.
[static]
QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4)
This is an overloaded function.
Returns the Unicode version that introduced the character specified in its UCS-4-encoded form as ucs4.
Related Non-Members
bool operator!=(QChar c1, QChar c2)
Returns true
if c1 and c2 are not the same Unicode character; otherwise returns false
.
bool operator<(QChar c1, QChar c2)
Returns true
if the numeric Unicode value of c1 is less than that of c2; otherwise returns false
.
QDataStream &operator<<(QDataStream &out, QChar chr)
Writes the char chr to the stream out.
See also Serializing Qt Data Types.
bool operator<=(QChar c1, QChar c2)
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
bool operator==(QChar c1, QChar c2)
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
bool operator>(QChar c1, QChar c2)
Returns true
if the numeric Unicode value of c1 is greater than that of c2; otherwise returns false
.
bool operator>=(QChar c1, QChar c2)
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
QDataStream &operator>>(QDataStream &in, QChar &chr)
Reads a char from the stream in into char chr.
See also Serializing Qt Data Types.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.