Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QChar Class Reference

\inmodule QtCore More...

#include <qchar.h>

+ Collaboration diagram for QChar:

Public Types

enum  SpecialCharacter {
  Null = 0x0000 , Tabulation = 0x0009 , LineFeed = 0x000a , FormFeed = 0x000c ,
  CarriageReturn = 0x000d , Space = 0x0020 , Nbsp = 0x00a0 , SoftHyphen = 0x00ad ,
  ReplacementCharacter = 0xfffd , ObjectReplacementCharacter = 0xfffc , ByteOrderMark = 0xfeff , ByteOrderSwapped = 0xfffe ,
  ParagraphSeparator = 0x2029 , LineSeparator = 0x2028 , VisualTabCharacter = 0x2192 , LastValidCodePoint = 0x10ffff
}
 \value Null A QChar with this value isNull(). More...
 
enum  Category {
  Mark_NonSpacing , Mark_SpacingCombining , Mark_Enclosing , Number_DecimalDigit ,
  Number_Letter , Number_Other , Separator_Space , Separator_Line ,
  Separator_Paragraph , Other_Control , Other_Format , Other_Surrogate ,
  Other_PrivateUse , Other_NotAssigned , Letter_Uppercase , Letter_Lowercase ,
  Letter_Titlecase , Letter_Modifier , Letter_Other , Punctuation_Connector ,
  Punctuation_Dash , Punctuation_Open , Punctuation_Close , Punctuation_InitialQuote ,
  Punctuation_FinalQuote , Punctuation_Other , Symbol_Math , Symbol_Currency ,
  Symbol_Modifier , Symbol_Other
}
 This enum maps the Unicode character categories. More...
 
enum  Script {
  Script_Unknown , Script_Inherited , Script_Common , Script_Latin ,
  Script_Greek , Script_Cyrillic , Script_Armenian , Script_Hebrew ,
  Script_Arabic , Script_Syriac , Script_Thaana , Script_Devanagari ,
  Script_Bengali , Script_Gurmukhi , Script_Gujarati , Script_Oriya ,
  Script_Tamil , Script_Telugu , Script_Kannada , Script_Malayalam ,
  Script_Sinhala , Script_Thai , Script_Lao , Script_Tibetan ,
  Script_Myanmar , Script_Georgian , Script_Hangul , Script_Ethiopic ,
  Script_Cherokee , Script_CanadianAboriginal , Script_Ogham , Script_Runic ,
  Script_Khmer , Script_Mongolian , Script_Hiragana , Script_Katakana ,
  Script_Bopomofo , Script_Han , Script_Yi , Script_OldItalic ,
  Script_Gothic , Script_Deseret , Script_Tagalog , Script_Hanunoo ,
  Script_Buhid , Script_Tagbanwa , Script_Coptic , Script_Limbu ,
  Script_TaiLe , Script_LinearB , Script_Ugaritic , Script_Shavian ,
  Script_Osmanya , Script_Cypriot , Script_Braille , Script_Buginese ,
  Script_NewTaiLue , Script_Glagolitic , Script_Tifinagh , Script_SylotiNagri ,
  Script_OldPersian , Script_Kharoshthi , Script_Balinese , Script_Cuneiform ,
  Script_Phoenician , Script_PhagsPa , Script_Nko , Script_Sundanese ,
  Script_Lepcha , Script_OlChiki , Script_Vai , Script_Saurashtra ,
  Script_KayahLi , Script_Rejang , Script_Lycian , Script_Carian ,
  Script_Lydian , Script_Cham , Script_TaiTham , Script_TaiViet ,
  Script_Avestan , Script_EgyptianHieroglyphs , Script_Samaritan , Script_Lisu ,
  Script_Bamum , Script_Javanese , Script_MeeteiMayek , Script_ImperialAramaic ,
  Script_OldSouthArabian , Script_InscriptionalParthian , Script_InscriptionalPahlavi , Script_OldTurkic ,
  Script_Kaithi , Script_Batak , Script_Brahmi , Script_Mandaic ,
  Script_Chakma , Script_MeroiticCursive , Script_MeroiticHieroglyphs , Script_Miao ,
  Script_Sharada , Script_SoraSompeng , Script_Takri , Script_CaucasianAlbanian ,
  Script_BassaVah , Script_Duployan , Script_Elbasan , Script_Grantha ,
  Script_PahawhHmong , Script_Khojki , Script_LinearA , Script_Mahajani ,
  Script_Manichaean , Script_MendeKikakui , Script_Modi , Script_Mro ,
  Script_OldNorthArabian , Script_Nabataean , Script_Palmyrene , Script_PauCinHau ,
  Script_OldPermic , Script_PsalterPahlavi , Script_Siddham , Script_Khudawadi ,
  Script_Tirhuta , Script_WarangCiti , Script_Ahom , Script_AnatolianHieroglyphs ,
  Script_Hatran , Script_Multani , Script_OldHungarian , Script_SignWriting ,
  Script_Adlam , Script_Bhaiksuki , Script_Marchen , Script_Newa ,
  Script_Osage , Script_Tangut , Script_MasaramGondi , Script_Nushu ,
  Script_Soyombo , Script_ZanabazarSquare , Script_Dogra , Script_GunjalaGondi ,
  Script_HanifiRohingya , Script_Makasar , Script_Medefaidrin , Script_OldSogdian ,
  Script_Sogdian , Script_Elymaic , Script_Nandinagari , Script_NyiakengPuachueHmong ,
  Script_Wancho , Script_Chorasmian , Script_DivesAkuru , Script_KhitanSmallScript ,
  Script_Yezidi , Script_CyproMinoan , Script_OldUyghur , Script_Tangsa ,
  Script_Toto , Script_Vithkuqi , Script_Kawi , Script_NagMundari ,
  ScriptCount
}
 
enum  Direction {
  DirL , DirR , DirEN , DirES ,
  DirET , DirAN , DirCS , DirB ,
  DirS , DirWS , DirON , DirLRE ,
  DirLRO , DirAL , DirRLE , DirRLO ,
  DirPDF , DirNSM , DirBN , DirLRI ,
  DirRLI , DirFSI , DirPDI
}
 This enum type defines the Unicode direction attributes. More...
 
enum  Decomposition {
  NoDecomposition , Canonical , Font , NoBreak ,
  Initial , Medial , Final , Isolated ,
  Circle , Super , Sub , Vertical ,
  Wide , Narrow , Small , Square ,
  Compat , Fraction
}
 This enum type defines the Unicode decomposition attributes. More...
 
enum  JoiningType {
  Joining_None , Joining_Causing , Joining_Dual , Joining_Right ,
  Joining_Left , Joining_Transparent
}
 since 5.3 More...
 
enum  CombiningClass {
  Combining_BelowLeftAttached = 200 , Combining_BelowAttached = 202 , Combining_BelowRightAttached = 204 , Combining_LeftAttached = 208 ,
  Combining_RightAttached = 210 , Combining_AboveLeftAttached = 212 , Combining_AboveAttached = 214 , Combining_AboveRightAttached = 216 ,
  Combining_BelowLeft = 218 , Combining_Below = 220 , Combining_BelowRight = 222 , Combining_Left = 224 ,
  Combining_Right = 226 , Combining_AboveLeft = 228 , Combining_Above = 230 , Combining_AboveRight = 232 ,
  Combining_DoubleBelow = 233 , Combining_DoubleAbove = 234 , Combining_IotaSubscript = 240
}
 
enum  UnicodeVersion {
  Unicode_Unassigned , Unicode_1_1 , Unicode_2_0 , Unicode_2_1_2 ,
  Unicode_3_0 , Unicode_3_1 , Unicode_3_2 , Unicode_4_0 ,
  Unicode_4_1 , Unicode_5_0 , Unicode_5_1 , Unicode_5_2 ,
  Unicode_6_0 , Unicode_6_1 , Unicode_6_2 , Unicode_6_3 ,
  Unicode_7_0 , Unicode_8_0 , Unicode_9_0 , Unicode_10_0 ,
  Unicode_11_0 , Unicode_12_0 , Unicode_12_1 , Unicode_13_0 ,
  Unicode_14_0 , Unicode_15_0
}
 Specifies which version of the \l{Unicode standard} introduced a certain character. More...
 

Public Member Functions

constexpr Q_IMPLICIT QChar () noexcept
 Constructs a null QChar ('\0').
 
constexpr Q_IMPLICIT QChar (ushort rc) noexcept
 Constructs a QChar for the character with Unicode code point code.
 
constexpr QCHAR_MAYBE_IMPLICIT QChar (uchar c, uchar r) noexcept
 Constructs a QChar for Unicode cell cell in row row.
 
constexpr Q_IMPLICIT QChar (short rc) noexcept
 Constructs a QChar for the character with Unicode code point code.
 
constexpr QCHAR_MAYBE_IMPLICIT QChar (uint rc) noexcept
 Constructs a QChar for the character with Unicode code point code.
 
constexpr QCHAR_MAYBE_IMPLICIT QChar (int rc) noexcept
 Constructs a QChar for the character with Unicode code point code.
 
constexpr Q_IMPLICIT QChar (SpecialCharacter s) noexcept
 Constructs a QChar for the predefined character value ch.
 
constexpr Q_IMPLICIT QChar (QLatin1Char ch) noexcept
 Constructs a QChar corresponding to ASCII/Latin-1 character ch.
 
constexpr Q_IMPLICIT QChar (char16_t ch) noexcept
 
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar (char c) noexcept
 Constructs a QChar corresponding to ASCII/Latin-1 character ch.
 
QT_ASCII_CAST_WARN constexpr QCHAR_MAYBE_IMPLICIT QChar (uchar c) noexcept
 Constructs a QChar corresponding to ASCII/Latin-1 character ch.
 
Category category () const noexcept
 Returns the character's category.
 
Direction direction () const noexcept
 Returns the character's direction.
 
JoiningType joiningType () const noexcept
 
unsigned char combiningClass () const noexcept
 Returns the combining class for the character as defined in the Unicode standard.
 
QChar mirroredChar () const noexcept
 Returns the mirrored character if this character is a mirrored character; otherwise returns the character itself.
 
bool hasMirrored () const noexcept
 Returns true if the character should be reversed if the text direction is reversed; otherwise returns false.
 
QString decomposition () const
 Decomposes a character into it's constituent parts.
 
Decomposition decompositionTag () const noexcept
 Returns the tag defining the composition of the character.
 
int digitValue () const noexcept
 Returns the numeric value of the digit, or -1 if the character is not a digit.
 
QChar toLower () const noexcept
 Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the character itself.
 
QChar toUpper () const noexcept
 Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the character itself.
 
QChar toTitleCase () const noexcept
 Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the character itself.
 
QChar toCaseFolded () const noexcept
 Returns the case folded equivalent of the character.
 
Script script () const noexcept
 
UnicodeVersion unicodeVersion () const noexcept
 Returns the Unicode version that introduced this character.
 
constexpr char toLatin1 () const noexcept
 Returns the Latin-1 character equivalent to the QChar, or 0.
 
constexpr char16_t unicode () const noexcept
 Returns the numeric Unicode value of the QChar.
 
constexpr char16_t & unicode () noexcept
 Returns a reference to the numeric Unicode value of the QChar.
 
constexpr bool isNull () const noexcept
 Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.
 
bool isPrint () const noexcept
 Returns true if the character is a printable character; otherwise returns false.
 
constexpr bool isSpace () const noexcept
 Returns true if the character is a separator character (Separator_* categories or certain code points from Other_Control category); otherwise returns false.
 
bool isMark () const noexcept
 Returns true if the character is a mark (Mark_* categories); otherwise returns false.
 
bool isPunct () const noexcept
 Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns false.
 
bool isSymbol () const noexcept
 Returns true if the character is a symbol (Symbol_* categories); otherwise returns false.
 
constexpr bool isLetter () const noexcept
 Returns true if the character is a letter (Letter_* categories); otherwise returns false.
 
constexpr bool isNumber () const noexcept
 Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns false.
 
constexpr bool isLetterOrNumber () const noexcept
 Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise returns false.
 
constexpr bool isDigit () const noexcept
 Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false.
 
constexpr bool isLower () const noexcept
 Returns true if the character is a lowercase letter, for example category() is Letter_Lowercase.
 
constexpr bool isUpper () const noexcept
 Returns true if the character is an uppercase letter, for example category() is Letter_Uppercase.
 
constexpr bool isTitleCase () const noexcept
 Returns true if the character is a titlecase letter, for example category() is Letter_Titlecase.
 
constexpr bool isNonCharacter () const noexcept
 
constexpr bool isHighSurrogate () const noexcept
 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.
 
constexpr bool isLowSurrogate () const noexcept
 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.
 
constexpr bool isSurrogate () const noexcept
 
constexpr uchar cell () const noexcept
 Returns the cell (least significant byte) of the Unicode character.
 
constexpr uchar row () const noexcept
 Returns the row (most significant byte) of the Unicode character.
 
constexpr void setCell (uchar acell) noexcept
 
constexpr void setRow (uchar arow) noexcept
 

Static Public Member Functions

static constexpr QChar fromUcs2 (char16_t c) noexcept
 
static constexpr auto fromUcs4 (char32_t c) noexcept
 
static constexpr QChar fromLatin1 (char c) noexcept
 Converts the Latin-1 character c to its equivalent QChar.
 
static constexpr bool isNonCharacter (char32_t ucs4) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isHighSurrogate (char32_t ucs4) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.
 
static constexpr bool isLowSurrogate (char32_t ucs4) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.
 
static constexpr bool isSurrogate (char32_t ucs4) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool requiresSurrogates (char32_t ucs4) noexcept
 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.
 
static constexpr char32_t surrogateToUcs4 (char16_t high, char16_t low) noexcept
 Converts a UTF16 surrogate pair with the given high and low values to it's UCS-4-encoded code point.
 
static constexpr char32_t surrogateToUcs4 (QChar high, QChar low) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Converts a UTF16 surrogate pair (high, low) to it's UCS-4-encoded code point.
 
static constexpr char16_t highSurrogate (char32_t ucs4) noexcept
 Returns the high surrogate part of a UCS-4-encoded code point.
 
static constexpr char16_t lowSurrogate (char32_t ucs4) noexcept
 Returns the low surrogate part of a UCS-4-encoded code point.
 
static Category QT_FASTCALL category (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the category of the UCS-4-encoded character specified by ucs4.
 
static Direction QT_FASTCALL direction (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the direction of the UCS-4-encoded character specified by ucs4.
 
static JoiningType QT_FASTCALL joiningType (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static unsigned char QT_FASTCALL combiningClass (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the combining class for the UCS-4-encoded character specified by ucs4, as defined in the Unicode standard.
 
static char32_t QT_FASTCALL mirroredChar (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the mirrored character if the UCS-4-encoded character specified by ucs4 is a mirrored character; otherwise returns the character itself.
 
static bool QT_FASTCALL hasMirrored (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static QString QT_FASTCALL decomposition (char32_t ucs4)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Decomposes the UCS-4-encoded character specified by ucs4 into it's constituent parts.
 
static Decomposition QT_FASTCALL decompositionTag (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the tag defining the composition of the UCS-4-encoded character specified by ucs4.
 
static int QT_FASTCALL digitValue (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the numeric value of the digit specified by the UCS-4-encoded character, ucs4, or -1 if the character is not a digit.
 
static char32_t QT_FASTCALL toLower (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.
 
static char32_t QT_FASTCALL toUpper (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.
 
static char32_t QT_FASTCALL toTitleCase (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.
 
static char32_t QT_FASTCALL toCaseFolded (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the case folded equivalent of the UCS-4-encoded character specified by ucs4.
 
static Script QT_FASTCALL script (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static UnicodeVersion QT_FASTCALL unicodeVersion (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the Unicode version that introduced the character specified in its UCS-4-encoded form as ucs4.
 
static UnicodeVersion QT_FASTCALL currentUnicodeVersion () noexcept Q_DECL_CONST_FUNCTION
 Returns the most recent supported Unicode version.
 
static bool QT_FASTCALL isPrint (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isSpace (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static bool QT_FASTCALL isMark (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static bool QT_FASTCALL isPunct (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static bool QT_FASTCALL isSymbol (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isLetter (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isNumber (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isLetterOrNumber (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isDigit (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isLower (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isUpper (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static constexpr bool isTitleCase (char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Friends

constexpr bool operator== (QChar c1, QChar c2) noexcept
 Returns true if c1 and c2 are the same Unicode character; otherwise returns false.
 
constexpr bool operator< (QChar c1, QChar c2) noexcept
 Returns true if the numeric Unicode value of c1 is less than that of c2; otherwise returns false.
 
constexpr bool operator!= (QChar c1, QChar c2) noexcept
 Returns true if c1 and c2 are not the same Unicode character; otherwise returns false.
 
constexpr bool operator>= (QChar c1, QChar c2) noexcept
 Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.
 
constexpr bool operator> (QChar c1, QChar c2) noexcept
 Returns true if the numeric Unicode value of c1 is greater than that of c2; otherwise returns false.
 
constexpr bool operator<= (QChar c1, QChar c2) noexcept
 Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.
 
constexpr bool operator== (QChar lhs, std::nullptr_t) noexcept
 
constexpr bool operator< (QChar, std::nullptr_t) noexcept
 
constexpr bool operator== (std::nullptr_t, QChar rhs) noexcept
 
constexpr bool operator< (std::nullptr_t, QChar rhs) noexcept
 
constexpr bool operator!= (QChar lhs, std::nullptr_t) noexcept
 
constexpr bool operator>= (QChar lhs, std::nullptr_t) noexcept
 
constexpr bool operator> (QChar lhs, std::nullptr_t) noexcept
 
constexpr bool operator<= (QChar lhs, std::nullptr_t) noexcept
 
constexpr bool operator!= (std::nullptr_t, QChar rhs) noexcept
 
constexpr bool operator>= (std::nullptr_t, QChar rhs) noexcept
 
constexpr bool operator> (std::nullptr_t, QChar rhs) noexcept
 
constexpr bool operator<= (std::nullptr_t, QChar rhs) noexcept
 

Related Symbols

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &out, QChar chr)
 Writes the char chr to the stream out.
 
QDataStreamoperator>> (QDataStream &in, QChar &chr)
 Reads a char from the stream in into char chr.
 

Detailed Description

\inmodule QtCore

The QChar class provides a 16-bit Unicode character.

\reentrant

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.

Starting with Qt 6.0, most QChar constructors are explicit. This is done to avoid dangerous mistakes when accidentally mixing integral types and strings. You can opt-out (and make these constructors implicit) by defining the macro QT_IMPLICIT_QCHAR_CONSTRUCTION.

For more information see \l{https://www.unicode.org/ucd/}{"About the Unicode Character Database"}.

See also
Unicode, QString, QLatin1Char

Definition at line 48 of file qchar.h.

Member Enumeration Documentation

◆ Category

This enum maps the Unicode character categories.

The following characters are normative in Unicode:

\value Mark_NonSpacing Unicode class name Mn

\value Mark_SpacingCombining Unicode class name Mc

\value Mark_Enclosing Unicode class name Me

\value Number_DecimalDigit Unicode class name Nd

\value Number_Letter Unicode class name Nl

\value Number_Other Unicode class name No

\value Separator_Space Unicode class name Zs

\value Separator_Line Unicode class name Zl

\value Separator_Paragraph Unicode class name Zp

\value Other_Control Unicode class name Cc

\value Other_Format Unicode class name Cf

\value Other_Surrogate Unicode class name Cs

\value Other_PrivateUse Unicode class name Co

\value Other_NotAssigned Unicode class name Cn

The following categories are informative in Unicode:

\value Letter_Uppercase Unicode class name Lu

\value Letter_Lowercase Unicode class name Ll

\value Letter_Titlecase Unicode class name Lt

\value Letter_Modifier Unicode class name Lm

\value Letter_Other Unicode class name Lo

\value Punctuation_Connector Unicode class name Pc

\value Punctuation_Dash Unicode class name Pd

\value Punctuation_Open Unicode class name Ps

\value Punctuation_Close Unicode class name Pe

\value Punctuation_InitialQuote Unicode class name Pi

\value Punctuation_FinalQuote Unicode class name Pf

\value Punctuation_Other Unicode class name Po

\value Symbol_Math Unicode class name Sm

\value Symbol_Currency Unicode class name Sc

\value Symbol_Modifier Unicode class name Sk

\value Symbol_Other Unicode class name So

See also
category()
Enumerator
Mark_NonSpacing 
Mark_SpacingCombining 
Mark_Enclosing 
Number_DecimalDigit 
Number_Letter 
Number_Other 
Separator_Space 
Separator_Line 
Separator_Paragraph 
Other_Control 
Other_Format 
Other_Surrogate 
Other_PrivateUse 
Other_NotAssigned 
Letter_Uppercase 
Letter_Lowercase 
Letter_Titlecase 
Letter_Modifier 
Letter_Other 
Punctuation_Connector 
Punctuation_Dash 
Punctuation_Open 
Punctuation_Close 
Punctuation_InitialQuote 
Punctuation_FinalQuote 
Punctuation_Other 
Symbol_Math 
Symbol_Currency 
Symbol_Modifier 
Symbol_Other 

Definition at line 103 of file qchar.h.

◆ CombiningClass

This enum type defines names for some of the Unicode combining classes. See the \l{Unicode Standard} for a description of the values.

\value Combining_Above \value Combining_AboveAttached \value Combining_AboveLeft \value Combining_AboveLeftAttached \value Combining_AboveRight \value Combining_AboveRightAttached \value Combining_Below \value Combining_BelowAttached \value Combining_BelowLeft \value Combining_BelowLeftAttached \value Combining_BelowRight \value Combining_BelowRightAttached \value Combining_DoubleAbove \value Combining_DoubleBelow \value Combining_IotaSubscript \value Combining_Left \value Combining_LeftAttached \value Combining_Right \value Combining_RightAttached

Enumerator
Combining_BelowLeftAttached 
Combining_BelowAttached 
Combining_BelowRightAttached 
Combining_LeftAttached 
Combining_RightAttached 
Combining_AboveLeftAttached 
Combining_AboveAttached 
Combining_AboveRightAttached 
Combining_BelowLeft 
Combining_Below 
Combining_BelowRight 
Combining_Left 
Combining_Right 
Combining_AboveLeft 
Combining_Above 
Combining_AboveRight 
Combining_DoubleBelow 
Combining_DoubleAbove 
Combining_IotaSubscript 

Definition at line 382 of file qchar.h.

◆ Decomposition

This enum type defines the Unicode decomposition attributes.

See the \l{Unicode standard} for a description of the values.

\value NoDecomposition \value Canonical \value Circle \value Compat \value Final \value Font \value Fraction \value Initial \value Isolated \value Medial \value Narrow \value NoBreak \value Small \value Square \value Sub \value Super \value Vertical \value Wide

See also
decomposition()
Enumerator
NoDecomposition 
Canonical 
Font 
NoBreak 
Initial 
Medial 
Final 
Isolated 
Circle 
Super 
Sub 
Vertical 
Wide 
Narrow 
Small 
Square 
Compat 
Fraction 

Definition at line 351 of file qchar.h.

◆ Direction

This enum type defines the Unicode direction attributes.

See the \l{https://www.unicode.org/reports/tr9/tr9-35.html#Table_Bidirectional_Character_Types}{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.

\value DirAL \value DirAN \value DirB \value DirBN \value DirCS \value DirEN \value DirES \value DirET \value [since 5.3] DirFSI \value DirL \value DirLRE \value [since 5.3] DirLRI \value DirLRO \value DirNSM \value DirON \value DirPDF \value [since 5.3] DirPDI \value DirR \value DirRLE \value [since 5.3] DirRLI \value DirRLO \value DirS \value DirWS

See also
direction()
Enumerator
DirL 
DirR 
DirEN 
DirES 
DirET 
DirAN 
DirCS 
DirB 
DirS 
DirWS 
DirON 
DirLRE 
DirLRO 
DirAL 
DirRLE 
DirRLO 
DirPDF 
DirNSM 
DirBN 
DirLRI 
DirRLI 
DirFSI 
DirPDI 

Definition at line 344 of file qchar.h.

◆ JoiningType

since 5.3

This enum type defines the Unicode joining type attributes. See the \l{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.

\value Joining_None \value Joining_Causing \value Joining_Dual \value Joining_Right \value Joining_Left \value Joining_Transparent

See also
joiningType()
Enumerator
Joining_None 
Joining_Causing 
Joining_Dual 
Joining_Right 
Joining_Left 
Joining_Transparent 

Definition at line 373 of file qchar.h.

◆ Script

Since
5.1

This enum type defines the Unicode script property values.

For details about the Unicode script property values see \l{https://www.unicode.org/reports/tr24/}{Unicode Standard Annex #24}.

In order to conform to C/C++ naming conventions "Script_" is prepended to the codes used in the Unicode Standard.

\value Script_Unknown For unassigned, private-use, noncharacter, and surrogate code points. \value Script_Inherited 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. \value Script_Common For characters that may be used with multiple scripts and that do not inherit their script from the preceding characters.

\value [since 5.11] Script_Adlam \value [since 5.6] Script_Ahom \value [since 5.6] Script_AnatolianHieroglyphs \value Script_Arabic \value Script_Armenian \value Script_Avestan \value Script_Balinese \value Script_Bamum \value [since 5.5] Script_BassaVah \value Script_Batak \value Script_Bengali \value [since 5.11] Script_Bhaiksuki \value Script_Bopomofo \value Script_Brahmi \value Script_Braille \value Script_Buginese \value Script_Buhid \value Script_CanadianAboriginal \value Script_Carian \value [since 5.5] Script_CaucasianAlbanian \value Script_Chakma \value Script_Cham \value Script_Cherokee \value [since 5.15] Script_Chorasmian \value Script_Coptic \value Script_Cuneiform \value Script_Cypriot \value [since 6.3] Script_CyproMinoan \value Script_Cyrillic \value Script_Deseret \value Script_Devanagari \value [since 5.15] Script_DivesAkuru \value [since 5.15] Script_Dogra \value [since 5.5] Script_Duployan \value Script_EgyptianHieroglyphs \value [since 5.5] Script_Elbasan \value [since 5.15] Script_Elymaic \value Script_Ethiopic \value Script_Georgian \value Script_Glagolitic \value Script_Gothic \value [since 5.5] Script_Grantha \value Script_Greek \value Script_Gujarati \value [since 5.15] Script_GunjalaGondi \value Script_Gurmukhi \value Script_Han \value Script_Hangul \value [since 5.15] Script_HanifiRohingya \value Script_Hanunoo \value [since 5.6] Script_Hatran \value Script_Hebrew \value Script_Hiragana \value Script_ImperialAramaic \value Script_InscriptionalPahlavi \value Script_InscriptionalParthian \value Script_Javanese \value Script_Kaithi \value Script_Kannada \value Script_Katakana \value [since 6.5] Script_Kawi \value Script_KayahLi \value Script_Kharoshthi \value [since 5.15] Script_KhitanSmallScript \value Script_Khmer \value [since 5.5] Script_Khojki \value [since 5.5] Script_Khudawadi \value Script_Lao \value Script_Latin \value Script_Lepcha \value Script_Limbu \value [since 5.5] Script_LinearA \value Script_LinearB \value Script_Lisu \value Script_Lycian \value Script_Lydian \value [since 5.5] Script_Mahajani \value [since 5.15] Script_Makasar \value Script_Malayalam \value Script_Mandaic \value [since 5.5] Script_Manichaean \value [since 5.11] Script_Marchen \value [since 5.11] Script_MasaramGondi \value [since 5.15] Script_Medefaidrin \value Script_MeeteiMayek \value [since 5.5] Script_MendeKikakui \value Script_MeroiticCursive \value Script_MeroiticHieroglyphs \value Script_Miao \value [since 5.5] Script_Modi \value Script_Mongolian \value [since 5.5] Script_Mro \value [since 5.6] Script_Multani \value Script_Myanmar \value [since 5.5] Script_Nabataean \value [since 6.3] Script_NagMundari \value [since 5.15] Script_Nandinagari \value [since 5.11] Script_Newa \value Script_NewTaiLue \value Script_Nko \value [since 5.11] Script_Nushu \value [since 5.15] Script_NyiakengPuachueHmong \value Script_Ogham \value Script_OlChiki \value [since 5.6] Script_OldHungarian \value Script_OldItalic \value [since 5.5] Script_OldNorthArabian \value [since 5.5] Script_OldPermic \value Script_OldPersian \value [since 5.15] Script_OldSogdian \value Script_OldSouthArabian \value Script_OldTurkic \value [since 6.3] Script_OldUyghur \value Script_Oriya \value [since 5.11] Script_Osage \value Script_Osmanya \value [since 5.5] Script_PahawhHmong \value [since 5.5] Script_Palmyrene \value [since 5.5] Script_PauCinHau \value Script_PhagsPa \value Script_Phoenician \value [since 5.5] Script_PsalterPahlavi \value Script_Rejang \value Script_Runic \value Script_Samaritan \value Script_Saurashtra \value Script_Sharada \value Script_Shavian \value [since 5.5] Script_Siddham \value [since 5.6] Script_SignWriting \value Script_Sinhala \value [since 5.15] Script_Sogdian \value Script_SoraSompeng \value [since 5.11] Script_Soyombo \value Script_Sundanese \value Script_SylotiNagri \value Script_Syriac \value Script_Tagalog \value Script_Tagbanwa \value Script_TaiLe \value Script_TaiTham \value Script_TaiViet \value Script_Takri \value Script_Tamil \value [since 5.11] Script_Tangut \value [since 6.3] Script_Tangsa \value Script_Telugu \value Script_Thaana \value Script_Thai \value Script_Tibetan \value Script_Tifinagh \value [since 5.5] Script_Tirhuta \value [since 6.3] Script_Toto \value Script_Ugaritic \value Script_Vai \value [since 6.3] Script_Vithkuqi \value [since 5.15] Script_Wancho \value [since 5.5] Script_WarangCiti \value [since 5.15] Script_Yezidi \value Script_Yi \value [since 5.11] Script_ZanabazarSquare

\omitvalue ScriptCount

See also
script()
Enumerator
Script_Unknown 
Script_Inherited 
Script_Common 
Script_Latin 
Script_Greek 
Script_Cyrillic 
Script_Armenian 
Script_Hebrew 
Script_Arabic 
Script_Syriac 
Script_Thaana 
Script_Devanagari 
Script_Bengali 
Script_Gurmukhi 
Script_Gujarati 
Script_Oriya 
Script_Tamil 
Script_Telugu 
Script_Kannada 
Script_Malayalam 
Script_Sinhala 
Script_Thai 
Script_Lao 
Script_Tibetan 
Script_Myanmar 
Script_Georgian 
Script_Hangul 
Script_Ethiopic 
Script_Cherokee 
Script_CanadianAboriginal 
Script_Ogham 
Script_Runic 
Script_Khmer 
Script_Mongolian 
Script_Hiragana 
Script_Katakana 
Script_Bopomofo 
Script_Han 
Script_Yi 
Script_OldItalic 
Script_Gothic 
Script_Deseret 
Script_Tagalog 
Script_Hanunoo 
Script_Buhid 
Script_Tagbanwa 
Script_Coptic 
Script_Limbu 
Script_TaiLe 
Script_LinearB 
Script_Ugaritic 
Script_Shavian 
Script_Osmanya 
Script_Cypriot 
Script_Braille 
Script_Buginese 
Script_NewTaiLue 
Script_Glagolitic 
Script_Tifinagh 
Script_SylotiNagri 
Script_OldPersian 
Script_Kharoshthi 
Script_Balinese 
Script_Cuneiform 
Script_Phoenician 
Script_PhagsPa 
Script_Nko 
Script_Sundanese 
Script_Lepcha 
Script_OlChiki 
Script_Vai 
Script_Saurashtra 
Script_KayahLi 
Script_Rejang 
Script_Lycian 
Script_Carian 
Script_Lydian 
Script_Cham 
Script_TaiTham 
Script_TaiViet 
Script_Avestan 
Script_EgyptianHieroglyphs 
Script_Samaritan 
Script_Lisu 
Script_Bamum 
Script_Javanese 
Script_MeeteiMayek 
Script_ImperialAramaic 
Script_OldSouthArabian 
Script_InscriptionalParthian 
Script_InscriptionalPahlavi 
Script_OldTurkic 
Script_Kaithi 
Script_Batak 
Script_Brahmi 
Script_Mandaic 
Script_Chakma 
Script_MeroiticCursive 
Script_MeroiticHieroglyphs 
Script_Miao 
Script_Sharada 
Script_SoraSompeng 
Script_Takri 
Script_CaucasianAlbanian 
Script_BassaVah 
Script_Duployan 
Script_Elbasan 
Script_Grantha 
Script_PahawhHmong 
Script_Khojki 
Script_LinearA 
Script_Mahajani 
Script_Manichaean 
Script_MendeKikakui 
Script_Modi 
Script_Mro 
Script_OldNorthArabian 
Script_Nabataean 
Script_Palmyrene 
Script_PauCinHau 
Script_OldPermic 
Script_PsalterPahlavi 
Script_Siddham 
Script_Khudawadi 
Script_Tirhuta 
Script_WarangCiti 
Script_Ahom 
Script_AnatolianHieroglyphs 
Script_Hatran 
Script_Multani 
Script_OldHungarian 
Script_SignWriting 
Script_Adlam 
Script_Bhaiksuki 
Script_Marchen 
Script_Newa 
Script_Osage 
Script_Tangut 
Script_MasaramGondi 
Script_Nushu 
Script_Soyombo 
Script_ZanabazarSquare 
Script_Dogra 
Script_GunjalaGondi 
Script_HanifiRohingya 
Script_Makasar 
Script_Medefaidrin 
Script_OldSogdian 
Script_Sogdian 
Script_Elymaic 
Script_Nandinagari 
Script_NyiakengPuachueHmong 
Script_Wancho 
Script_Chorasmian 
Script_DivesAkuru 
Script_KhitanSmallScript 
Script_Yezidi 
Script_CyproMinoan 
Script_OldUyghur 
Script_Tangsa 
Script_Toto 
Script_Vithkuqi 
Script_Kawi 
Script_NagMundari 
ScriptCount 

Definition at line 143 of file qchar.h.

◆ SpecialCharacter

\value Null A QChar with this value isNull().

\value Tabulation Character tabulation. \value LineFeed \value FormFeed \value CarriageReturn \value Space \value Nbsp Non-breaking space. \value SoftHyphen \value ReplacementCharacter 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. \value ObjectReplacementCharacter Used to represent an object such as an image when such objects cannot be presented. \value ByteOrderMark \value ByteOrderSwapped \value ParagraphSeparator \value LineSeparator \value [since 6.2] VisualTabCharacter Used to represent a tabulation as a horizontal arrow. \value LastValidCodePoint

Enumerator
Null 
Tabulation 
LineFeed 
FormFeed 
CarriageReturn 
Space 
Nbsp 
SoftHyphen 
ReplacementCharacter 
ObjectReplacementCharacter 
ByteOrderMark 
ByteOrderSwapped 
ParagraphSeparator 
LineSeparator 
VisualTabCharacter 
LastValidCodePoint 

Definition at line 50 of file qchar.h.

◆ UnicodeVersion

Specifies which version of the \l{Unicode standard} introduced a certain character.

\value Unicode_1_1 Version 1.1 \value Unicode_2_0 Version 2.0 \value Unicode_2_1_2 Version 2.1.2 \value Unicode_3_0 Version 3.0 \value Unicode_3_1 Version 3.1 \value Unicode_3_2 Version 3.2 \value Unicode_4_0 Version 4.0 \value Unicode_4_1 Version 4.1 \value Unicode_5_0 Version 5.0 \value Unicode_5_1 Version 5.1 \value Unicode_5_2 Version 5.2 \value Unicode_6_0 Version 6.0 \value Unicode_6_1 Version 6.1 \value Unicode_6_2 Version 6.2 \value [since 5.3] Unicode_6_3 Version 6.3 \value [since 5.5] Unicode_7_0 Version 7.0 \value [since 5.6] Unicode_8_0 Version 8.0 \value [since 5.11] Unicode_9_0 Version 9.0 \value [since 5.11] Unicode_10_0 Version 10.0 \value [since 5.15] Unicode_11_0 Version 11.0 \value [since 5.15] Unicode_12_0 Version 12.0 \value [since 5.15] Unicode_12_1 Version 12.1 \value [since 5.15] Unicode_13_0 Version 13.0 \value [since 6.3] Unicode_14_0 Version 14.0 \value [since 6.5] Unicode_15_0 Version 15.0 \value Unicode_Unassigned The value is not assigned to any character in version 8.0 of Unicode.

See also
unicodeVersion(), currentUnicodeVersion()
Enumerator
Unicode_Unassigned 
Unicode_1_1 
Unicode_2_0 
Unicode_2_1_2 
Unicode_3_0 
Unicode_3_1 
Unicode_3_2 
Unicode_4_0 
Unicode_4_1 
Unicode_5_0 
Unicode_5_1 
Unicode_5_2 
Unicode_6_0 
Unicode_6_1 
Unicode_6_2 
Unicode_6_3 
Unicode_7_0 
Unicode_8_0 
Unicode_9_0 
Unicode_10_0 
Unicode_11_0 
Unicode_12_0 
Unicode_12_1 
Unicode_13_0 
Unicode_14_0 
Unicode_15_0 

Definition at line 407 of file qchar.h.

Constructor & Destructor Documentation

◆ QChar() [1/11]

QChar::QChar ( )
inlineconstexprnoexcept

Constructs a null QChar ('\0').

See also
isNull()

Definition at line 75 of file qchar.h.

◆ QChar() [2/11]

QChar::QChar ( ushort  rc)
inlineconstexprnoexcept

Constructs a QChar for the character with Unicode code point code.

Definition at line 76 of file qchar.h.

◆ QChar() [3/11]

QChar::QChar ( uchar  cell,
uchar  row 
)
inlineconstexprnoexcept

Constructs a QChar for Unicode cell cell in row row.

See also
cell(), row()

Definition at line 77 of file qchar.h.

◆ QChar() [4/11]

QChar::QChar ( short  rc)
inlineconstexprnoexcept

Constructs a QChar for the character with Unicode code point code.

Definition at line 78 of file qchar.h.

◆ QChar() [5/11]

QChar::QChar ( uint  rc)
inlineconstexprnoexcept

Constructs a QChar for the character with Unicode code point code.

Definition at line 79 of file qchar.h.

◆ QChar() [6/11]

QChar::QChar ( int  rc)
inlineconstexprnoexcept

Constructs a QChar for the character with Unicode code point code.

Definition at line 80 of file qchar.h.

◆ QChar() [7/11]

QChar::QChar ( SpecialCharacter  s)
inlineconstexprnoexcept

Constructs a QChar for the predefined character value ch.

Definition at line 81 of file qchar.h.

◆ QChar() [8/11]

QChar::QChar ( QLatin1Char  ch)
inlineconstexprnoexcept

Constructs a QChar corresponding to ASCII/Latin-1 character ch.

Definition at line 82 of file qchar.h.

◆ QChar() [9/11]

QChar::QChar ( char16_t  ch)
inlineconstexprnoexcept
Since
5.10

Constructs a QChar corresponding to the UTF-16 character ch.

Definition at line 83 of file qchar.h.

◆ QChar() [10/11]

QChar::QChar ( char  ch)
inlineconstexprnoexcept

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

Definition at line 90 of file qchar.h.

◆ QChar() [11/11]

QChar::QChar ( uchar  ch)
inlineconstexprnoexcept

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, QT_RESTRICTED_CAST_FROM_ASCII

Definition at line 92 of file qchar.h.

Member Function Documentation

◆ category() [1/2]

QChar::Category QChar::category ( ) const
inlinenoexcept

Returns the character's category.

Definition at line 436 of file qchar.h.

References category().

Referenced by _hb_qt_unicode_general_category(), category(), QFontMetrics::horizontalAdvance(), QQnxScreenEventHandler::injectKeyboardEvent(), isDigit(), isIdentifierPart(), isIdentifierStart(), isLower(), isTitleCase(), isUpper(), and QFontEngineMulti::stringToCMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ category() [2/2]

QChar::Category QChar::category ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the category of the UCS-4-encoded character specified by ucs4.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1182 of file qchar.cpp.

References QUnicodeTables::Properties::category, Other_NotAssigned, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ cell()

uchar QChar::cell ( ) const
inlineconstexprnoexcept

Returns the cell (least significant byte) of the Unicode character.

See also
row()

Definition at line 483 of file qchar.h.

◆ combiningClass() [1/2]

unsigned char QChar::combiningClass ( ) const
inlinenoexcept

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.

Definition at line 439 of file qchar.h.

References combiningClass().

Referenced by _hb_qt_unicode_combining_class(), and combiningClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ combiningClass() [2/2]

unsigned char QChar::combiningClass ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the combining class for the UCS-4-encoded character specified by ucs4, as defined in the Unicode standard.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1460 of file qchar.cpp.

References QUnicodeTables::Properties::combiningClass, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ currentUnicodeVersion()

QChar::UnicodeVersion QChar::currentUnicodeVersion ( )
staticnoexcept

Returns the most recent supported Unicode version.

Definition at line 1513 of file qchar.cpp.

References UNICODE_DATA_VERSION.

Referenced by qt_string_normalize().

+ Here is the caller graph for this function:

◆ decomposition() [1/2]

QString QChar::decomposition ( ) const

Decomposes a character into it's constituent parts.

Returns an empty string if no decomposition exists.

Definition at line 1397 of file qchar.cpp.

References decomposition().

Referenced by _hb_qt_unicode_decompose(), and decomposition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decomposition() [2/2]

QString QChar::decomposition ( char32_t  ucs4)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Decomposes the UCS-4-encoded character specified by ucs4 into it's constituent parts.

Returns an empty string if no decomposition exists.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1409 of file qchar.cpp.

References d, decompositionHelper(), and tag.

+ Here is the call graph for this function:

◆ decompositionTag() [1/2]

QChar::Decomposition QChar::decompositionTag ( ) const
inlinenoexcept

Returns the tag defining the composition of the character.

Returns QChar::NoDecomposition if no decomposition exists.

Definition at line 445 of file qchar.h.

References decompositionTag().

Referenced by _hb_qt_unicode_decompose(), and decompositionTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decompositionTag() [2/2]

QChar::Decomposition QChar::decompositionTag ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the tag defining the composition of the UCS-4-encoded character specified by ucs4.

Returns QChar::NoDecomposition if no decomposition exists.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1432 of file qchar.cpp.

References Canonical, GET_DECOMPOSITION_INDEX, Hangul_SBase, Hangul_SCount, NoDecomposition, and QUnicodeTables::uc_decomposition_map.

◆ digitValue() [1/2]

int QChar::digitValue ( ) const
inlinenoexcept

Returns the numeric value of the digit, or -1 if the character is not a digit.

Definition at line 447 of file qchar.h.

References digitValue().

Referenced by digitValue(), QTextStreamPrivate::getNumber(), and keysymToQtKey_internal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ digitValue() [2/2]

int QChar::digitValue ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the numeric value of the digit specified by the UCS-4-encoded character, ucs4, or -1 if the character is not a digit.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1163 of file qchar.cpp.

References QUnicodeTables::Properties::digitValue, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ direction() [1/2]

QChar::Direction QChar::direction ( ) const
inlinenoexcept

Returns the character's direction.

Definition at line 437 of file qchar.h.

References direction().

Referenced by direction(), QStringView::isRightToLeft(), QTextBlock::textDirection(), QQuickTextInputPrivate::textDirection(), and QQuickTextEditPrivate::textDirection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ direction() [2/2]

QChar::Direction QChar::direction ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the direction of the UCS-4-encoded character specified by ucs4.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1201 of file qchar.cpp.

References QUnicodeTables::Properties::direction, DirL, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ fromLatin1()

QChar QChar::fromLatin1 ( char  c)
inlinestaticconstexprnoexcept

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(), unicode()

Definition at line 461 of file qchar.h.

Referenced by QQmlJS::Dom::CommentInfo::CommentInfo(), QQmlJS::Dom::QmlFile::addComponent(), QQmlJS::Dom::QmlFile::addImport(), QV4::PropertyKey::asFunctionName(), QTextMarkdownImporter::cbEnterBlock(), QQmlJS::Dom::PathEls::Root::checkName(), QQmlJS::Dom::PathEls::Current::checkName(), QSSGRenderShaderMetadata::Uniform::conditionFromString(), QV4::FunctionObject::createBuiltinFunction(), QV4::Object::defineAccessorProperty(), QQmlTreeModelToTableModel::dump(), QQmlJS::Dom::QQmlDomAstCreator::endVisit(), QQmlJS::Dom::ErrorGroups::fatal(), QDoubleValidatorPrivate::fixupWithLocale(), QQmlJS::Dom::Path::fromString(), QSSGAssetImportManager::getAllOptions(), QSSGBufferManager::loadMeshData(), QLocalSocketPrivate::parseSockaddr(), pathFromEntry(), QHttpNetworkConnectionPrivate::prepareRequest(), QQmlJS::Dom::ModuleIndex::qmldirsToLoad(), readInputFile(), resolveImagePath(), QSSGQmlUtilities::sanitizeQmlId(), QSSGQmlUtilities::sanitizeQmlSourcePath(), QSqlRelationalTableModel::selectStatement(), QTest::sendKeyEvent(), QMessagePattern::setPattern(), QQmlJS::Dom::sinkInt(), QQmlJS::Dom::Version::stringValue(), QSSGQmlUtilities::stripParentDirectory(), QIPAddressUtils::toHex(), and QV4::SymbolCtor::virtualCall().

+ Here is the caller graph for this function:

◆ fromUcs2()

static QChar QChar::fromUcs2 ( char16_t  c)
inlinestaticconstexprnoexcept
Since
6.0

Constructs a QChar from UTF-16 character c.

See also
fromUcs4()

Definition at line 98 of file qchar.h.

Referenced by QUtf16::convertToUnicode(), decode(), QTextList::itemText(), QKeySequencePrivate::keyName(), and QString::vasprintf().

+ Here is the caller graph for this function:

◆ fromUcs4()

constexpr auto QChar::fromUcs4 ( char32_t  c)
inlinestaticconstexprnoexcept
Since
6.0

Returns an anonymous struct that \list

  • contains a {char16_t chars[2]} array,
  • can be implicitly converted to a QStringView, and
  • iterated over with a C++11 ranged for loop. \endlist

If c requires surrogates, {chars[0]} contains the high surrogate and {chars[1]} the low surrogate, and the QStringView has size 2. Otherwise, {chars[0]} contains c and {chars[1]} is \l{QChar::isNull}{null}, and the QStringView has size 1.

This allows easy use of the result:

static constexpr auto fromUcs4(char32_t c) noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
GLdouble s
[6]
Definition qopenglext.h:235
for (char16_t c16 : QChar::fromUcs4(ch))
use(c16);
\inmodule QtCore
Definition qchar.h:48
See also
fromUcs2(), requiresSurrogates()

Definition at line 436 of file qstringview.h.

References begin(), highSurrogate(), lowSurrogate(), and R.

Referenced by _hb_qt_unicode_compose(), QString::assign(), canonicalOrderHelper(), composeHelper(), QUtf32::convertToUnicode(), fixedCharData(), fullConvertCase(), keyString(), mapDomainName(), and QTextHtmlParser::parseEntity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasMirrored() [1/2]

bool QChar::hasMirrored ( ) const
inlinenoexcept

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()

Definition at line 442 of file qchar.h.

References hasMirrored().

Referenced by hasMirrored().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasMirrored() [2/2]

bool QChar::hasMirrored ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

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).

Note
Before Qt 6, this function took a uint argument.
See also
mirroredChar()

Definition at line 1257 of file qchar.cpp.

References QUnicodeTables::Properties::mirrorDiff, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ highSurrogate()

static char16_t QChar::highSurrogate ( char32_t  ucs4)
inlinestaticconstexprnoexcept

Returns the high surrogate part of a UCS-4-encoded code point.

The returned result is undefined if ucs4 is smaller than 0x10000.

Note
Before Qt 6, this function took a uint argument and returned ushort.

Definition at line 518 of file qchar.h.

Referenced by QUtf8BaseTraits::appendUcs4(), QUtf32::convertToUnicode(), QLocaleData::doubleToString(), encodedUtf8ToUtf16(), fromUcs4(), QCoreTextFontEngine::glyphIndex(), QKeySequencePrivate::keyName(), QV4::StringCtor::method_fromCodePoint(), qt_string_normalize(), qulltoa(), and QWindowsFontEngine::recalcAdvances().

+ Here is the caller graph for this function:

◆ isDigit() [1/2]

bool QChar::isDigit ( ) const
inlineconstexprnoexcept

Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false.

See also
isNumber()

Definition at line 473 of file qchar.h.

References isDigit().

Referenced by digitCount(), QTextStreamPrivate::getNumber(), Driver::headerFileName(), isDigit(), isQtModule(), keysymToQtKey_internal(), QMimeGlobPattern::matchFileName(), parseInt(), trimTwoDigits(), QmlTypeRegistrar::write(), and zeroPad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDigit() [2/2]

bool QChar::isDigit ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a decimal digit (Number_DecimalDigit); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.
See also
isNumber()

Definition at line 573 of file qchar.h.

References category().

+ Here is the call graph for this function:

◆ isHighSurrogate() [1/2]

bool QChar::isHighSurrogate ( ) const
inlineconstexprnoexcept

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.

Definition at line 479 of file qchar.h.

References isHighSurrogate().

Referenced by advanceStringIndex(), QWidgetLineControl::backspace(), canonicalOrderHelper(), QUtf8::compareUtf8(), decomposeHelper(), QTextCursor::deletePreviousChar(), QRegularExpression::escape(), foldCase(), foldCase(), QUnicodeTools::getGraphemeBreaks(), QUnicodeTools::getLineBreaks(), QUnicodeTools::getSentenceBreaks(), QUnicodeTools::getWhiteSpaces(), QUnicodeTools::getWordBreaks(), QUnicodeTools::initScripts(), isHighSurrogate(), QV4::StringPrototype::method_codePointAt(), QStringIterator::next(), QStringIterator::nextUnchecked(), normalizationQuickCheckHelper(), QStringIterator::peekPrevious(), putEscapedString(), QStringIterator::recede(), QTextBlock::textDirection(), QUtf8Functions::toUtf8(), QLocaleData::DataRange::ucsFirst(), unicodeToEncodedUtf8(), and QLocaleData::zeroUcs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHighSurrogate() [2/2]

static bool QChar::isHighSurrogate ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 492 of file qchar.h.

◆ isLetter() [1/2]

bool QChar::isLetter ( ) const
inlineconstexprnoexcept

Returns true if the character is a letter (Letter_* categories); otherwise returns false.

Definition at line 470 of file qchar.h.

References isLetter().

Referenced by isLetter(), and isSignalPropertyName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLetter() [2/2]

bool QChar::isLetter ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a letter (Letter_* categories); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.

Definition at line 560 of file qchar.h.

◆ isLetterOrNumber() [1/2]

bool QChar::isLetterOrNumber ( ) const
inlineconstexprnoexcept

Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise returns false.

Definition at line 472 of file qchar.h.

References isLetterOrNumber().

Referenced by findInBlock(), isLetterOrNumber(), QDateTimeEditPrivate::isSeparatorKey(), and Recognizer::nextToken().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLetterOrNumber() [2/2]

bool QChar::isLetterOrNumber ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a letter or number (Letter_* or Number_* categories); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.

Definition at line 567 of file qchar.h.

◆ isLower() [1/2]

bool QChar::isLower ( ) const
inlineconstexprnoexcept

Returns true if the character is a lowercase letter, for example category() is Letter_Lowercase.

See also
isUpper(), toLower(), toUpper()

Definition at line 474 of file qchar.h.

References isLower().

Referenced by QmlTypesClassDescription::collect(), isLower(), and QmlIR::IRBuilder::visit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLower() [2/2]

static bool QChar::isLower ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a lowercase letter, for example category() is Letter_Lowercase.

Note
Before Qt 6, this function took a uint argument.
See also
isUpper(), toLower(), toUpper()

Definition at line 575 of file qchar.h.

References category().

+ Here is the call graph for this function:

◆ isLowSurrogate() [1/2]

bool QChar::isLowSurrogate ( ) const
inlineconstexprnoexcept

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.

Definition at line 480 of file qchar.h.

References isLowSurrogate().

Referenced by advanceStringIndex(), QWidgetLineControl::backspace(), canonicalOrderHelper(), QUtf8::compareUtf8(), QUtf32::convertFromUnicode(), decomposeHelper(), QTextCursor::deletePreviousChar(), QRegularExpressionPrivate::doMatch(), foldCase(), foldCase(), QUnicodeTools::getGraphemeBreaks(), QUnicodeTools::getLineBreaks(), QUnicodeTools::getSentenceBreaks(), QUnicodeTools::getWhiteSpaces(), QUnicodeTools::getWordBreaks(), QUnicodeTools::initScripts(), QInputControl::isAcceptableInput(), isLowSurrogate(), QV4::StringPrototype::method_codePointAt(), normalizationQuickCheckHelper(), QStringIterator::peekNext(), QStringIterator::previous(), QStringIterator::previousUnchecked(), putEscapedString(), QTextBlock::textDirection(), and QUtf8Functions::toUtf8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLowSurrogate() [2/2]

static bool QChar::isLowSurrogate ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 496 of file qchar.h.

◆ isMark() [1/2]

bool QChar::isMark ( ) const
inlinenoexcept

Returns true if the character is a mark (Mark_* categories); otherwise returns false.

See QChar::Category for more information regarding marks.

Definition at line 467 of file qchar.h.

References isMark().

Referenced by isMark().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMark() [2/2]

bool QChar::isMark ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a mark (Mark_* categories); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.

Definition at line 822 of file qchar.cpp.

References category(), FLAG, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ isNonCharacter() [1/2]

bool QChar::isNonCharacter ( ) const
inlineconstexprnoexcept
Since
5.0

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].

Definition at line 478 of file qchar.h.

References isNonCharacter().

Referenced by QUtf8Functions::fromUtf8(), isNonCharacter(), and QUtf8Functions::toUtf8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNonCharacter() [2/2]

static bool QChar::isNonCharacter ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

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].

Note
Before Qt 6, this function took a uint argument.

Definition at line 488 of file qchar.h.

◆ isNull()

bool QChar::isNull ( ) const
inlineconstexprnoexcept

Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.

Definition at line 463 of file qchar.h.

Referenced by QDateTimeParser::SectionNode::format(), QSqlResultPrivate::namedToPositionalBinding(), Recognizer::nextToken(), QTextHtmlParser::parseEntity(), QSqlResultPrivate::positionalToNamedBinding(), QFileSelectorPrivate::selectionHelper(), QDirPrivate::splitFilters(), QCocoaMenuItem::sync(), QQuickTextInputPrivate::textDirection(), and QQuickTextEditPrivate::textDirection().

+ Here is the caller graph for this function:

◆ isNumber() [1/2]

bool QChar::isNumber ( ) const
inlineconstexprnoexcept

Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns false.

See also
isDigit()

Definition at line 471 of file qchar.h.

References isNumber().

Referenced by isNumber(), QDateTimeEditPrivate::isSeparatorKey(), and QSSGQmlUtilities::sanitizeQmlId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNumber() [2/2]

bool QChar::isNumber ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a number (Number_* categories, not just 0-9); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.
See also
isDigit()

Definition at line 565 of file qchar.h.

◆ isPrint() [1/2]

bool QChar::isPrint ( ) const
inlinenoexcept

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.

Definition at line 465 of file qchar.h.

References isPrint().

Referenced by QtPrivate::QCalendarTextNavigator::eventFilter(), isPrint(), isPrintable(), isPrintable(), and QDoubleSpinBoxPrivate::validateAndInterpret().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPrint() [2/2]

bool QChar::isPrint ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 759 of file qchar.cpp.

References category(), FLAG, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ isPunct() [1/2]

bool QChar::isPunct ( ) const
inlinenoexcept

Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns false.

Definition at line 468 of file qchar.h.

References isPunct().

Referenced by isPunct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPunct() [2/2]

bool QChar::isPunct ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a punctuation mark (Punctuation_* categories); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.

Definition at line 848 of file qchar.cpp.

References category(), FLAG, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ isSpace() [1/2]

bool QChar::isSpace ( ) const
inlineconstexprnoexcept

◆ isSpace() [2/2]

bool QChar::isSpace ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 551 of file qchar.h.

◆ isSurrogate() [1/2]

bool QChar::isSurrogate ( ) const
inlineconstexprnoexcept
Since
5.0

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.

Definition at line 481 of file qchar.h.

References isSurrogate().

Referenced by QUtf8Functions::fromUtf8(), isSurrogate(), QStringIterator::next(), QStringIterator::previous(), qt_punycodeDecoder(), QUtf8Functions::toUtf8(), QLocaleData::DataRange::ucsFirst(), and QLocaleData::zeroUcs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSurrogate() [2/2]

static bool QChar::isSurrogate ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 500 of file qchar.h.

◆ isSymbol() [1/2]

bool QChar::isSymbol ( ) const
inlinenoexcept

Returns true if the character is a symbol (Symbol_* categories); otherwise returns false.

Definition at line 469 of file qchar.h.

References isSymbol().

Referenced by isSymbol().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSymbol() [2/2]

bool QChar::isSymbol ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a symbol (Symbol_* categories); otherwise returns false.

Note
Before Qt 6, this function took a uint argument.

Definition at line 878 of file qchar.cpp.

References category(), FLAG, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ isTitleCase() [1/2]

bool QChar::isTitleCase ( ) const
inlineconstexprnoexcept

Returns true if the character is a titlecase letter, for example category() is Letter_Titlecase.

See also
isLower(), toUpper(), toLower(), toTitleCase()

Definition at line 476 of file qchar.h.

References isTitleCase().

Referenced by isTitleCase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTitleCase() [2/2]

static bool QChar::isTitleCase ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is a titlecase letter, for example category() is Letter_Titlecase.

Note
Before Qt 6, this function took a uint argument.
See also
isLower(), toUpper(), toLower(), toTitleCase()

Definition at line 579 of file qchar.h.

References category().

+ Here is the call graph for this function:

◆ isUpper() [1/2]

◆ isUpper() [2/2]

static bool QChar::isUpper ( char32_t  ucs4)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.0

Returns true if the UCS-4-encoded character specified by ucs4 is an uppercase letter, for example category() is Letter_Uppercase.

Note
Before Qt 6, this function took a uint argument.
See also
isLower(), toUpper(), toLower()

Definition at line 577 of file qchar.h.

References category().

+ Here is the call graph for this function:

◆ joiningType() [1/2]

QChar::JoiningType QChar::joiningType ( ) const
inlinenoexcept
Since
5.3

Returns information about the joining type attributes of the character (needed for certain languages such as Arabic or Syriac).

Definition at line 438 of file qchar.h.

References joiningType().

Referenced by joiningType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ joiningType() [2/2]

QChar::JoiningType QChar::joiningType ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.3

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).

Note
Before Qt 6, this function took a uint argument.

Definition at line 1226 of file qchar.cpp.

References Joining_None, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ lowSurrogate()

static char16_t QChar::lowSurrogate ( char32_t  ucs4)
inlinestaticconstexprnoexcept

Returns the low surrogate part of a UCS-4-encoded code point.

The returned result is undefined if ucs4 is smaller than 0x10000.

Note
Before Qt 6, this function took a uint argument and returned ushort.

Definition at line 522 of file qchar.h.

Referenced by QUtf8BaseTraits::appendUcs4(), QUtf32::convertToUnicode(), QLocaleData::doubleToString(), encodedUtf8ToUtf16(), fromUcs4(), QCoreTextFontEngine::glyphIndex(), QKeySequencePrivate::keyName(), QV4::StringCtor::method_fromCodePoint(), qt_string_normalize(), qulltoa(), and QWindowsFontEngine::recalcAdvances().

+ Here is the caller graph for this function:

◆ mirroredChar() [1/2]

QChar QChar::mirroredChar ( ) const
inlinenoexcept

Returns the mirrored character if this character is a mirrored character; otherwise returns the character itself.

See also
hasMirrored()

Definition at line 441 of file qchar.h.

References mirroredChar().

Referenced by _hb_qt_unicode_mirroring(), and mirroredChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mirroredChar() [2/2]

char32_t QChar::mirroredChar ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the mirrored character if the UCS-4-encoded character specified by ucs4 is a mirrored character; otherwise returns the character itself.

Note
Before Qt 6, this function took a uint argument and returned uint.
See also
hasMirrored()

Definition at line 1347 of file qchar.cpp.

References QUnicodeTables::Properties::mirrorDiff, and QUnicodeTables::qGetProp().

+ Here is the call graph for this function:

◆ requiresSurrogates()

static bool QChar::requiresSurrogates ( char32_t  ucs4)
inlinestaticconstexprnoexcept

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.

Note
Before Qt 6, this function took a uint argument.

Definition at line 504 of file qchar.h.

Referenced by _hb_qt_unicode_decompose(), canonicalOrderHelper(), QUtf32::convertToUnicode(), decomposeHelper(), QLocaleData::doubleToString(), encode(), encodedUtf8ToUtf16(), QUtf8Functions::fromUtf8(), QCoreTextFontEngine::glyphIndex(), QKeySequencePrivate::keyName(), ligatureHelper(), qt_string_normalize(), and QWindowsFontEngine::recalcAdvances().

+ Here is the caller graph for this function:

◆ row()

uchar QChar::row ( ) const
inlineconstexprnoexcept

Returns the row (most significant byte) of the Unicode character.

See also
cell()

Definition at line 484 of file qchar.h.

◆ script() [1/2]

QChar::Script QChar::script ( ) const
inlinenoexcept
Since
5.1

Returns the Unicode script property value for this character.

Definition at line 453 of file qchar.h.

References script().

Referenced by _hb_qt_unicode_script(), QFontMetrics::inFontUcs4(), QFontMetricsF::inFontUcs4(), QWindowsDirectWriteFontDatabase::populateFamily(), and script().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ script() [2/2]

QChar::Script QChar::script ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.1

Returns the Unicode script property value for the character specified in its UCS-4-encoded form as ucs4.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1483 of file qchar.cpp.

References QUnicodeTables::qGetProp(), QUnicodeTables::Properties::script, and Script_Unknown.

+ Here is the call graph for this function:

◆ setCell()

void QChar::setCell ( uchar  cell)
inlineconstexprnoexcept

Definition at line 485 of file qchar.h.

◆ setRow()

void QChar::setRow ( uchar  row)
inlineconstexprnoexcept

Definition at line 486 of file qchar.h.

◆ surrogateToUcs4() [1/2]

◆ surrogateToUcs4() [2/2]

static char32_t QChar::surrogateToUcs4 ( QChar  high,
QChar  low 
)
inlinestaticconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Converts a UTF16 surrogate pair (high, low) to it's UCS-4-encoded code point.

Note
Before Qt 6, this function returned uint.

Definition at line 514 of file qchar.h.

◆ toCaseFolded() [1/2]

QChar QChar::toCaseFolded ( ) const
inlinenoexcept

Returns the case folded equivalent of the character.

For most Unicode characters this is the same as toLower().

Definition at line 451 of file qchar.h.

References toCaseFolded().

Referenced by QUtf8::compareUtf8(), QUtf8::compareUtf8(), QUtf8::compareUtf8(), QString::replace(), toCaseFolded(), and ucstricmp8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toCaseFolded() [2/2]

char32_t QChar::toCaseFolded ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the case folded equivalent of the UCS-4-encoded character specified by ucs4.

For most Unicode characters this is the same as toLower().

Note
Before Qt 6, this function took a uint argument and returned uint.

Definition at line 1673 of file qchar.cpp.

References QUnicodeTables::CaseFold, and convertCase_helper().

+ Here is the call graph for this function:

◆ toLatin1()

char QChar::toLatin1 ( ) const
inlineconstexprnoexcept

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()

Definition at line 457 of file qchar.h.

Referenced by QQmlJS::Dom::ErrorGroups::fatal(), QGeoUriProvider::getCurrentHost(), isQtModule(), maybeEscapeFirstChar(), QDateTimeParser::parseFormat(), QQuickSvgParser::parsePathDataFast(), and parsePathDataFast().

+ Here is the caller graph for this function:

◆ toLower() [1/2]

QChar QChar::toLower ( ) const
inlinenoexcept

Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the character itself.

Definition at line 448 of file qchar.h.

References toLower().

Referenced by QPdfSearchModel::QPdfSearchModel(), findTextEntry(), QTextStreamPrivate::getNumber(), QTextStreamPrivate::getReal(), hasValidSignal(), QQmlPropertyPrivate::initProperty(), QTextHtmlParser::parseEntity(), qt_UCSConvertCase(), Driver::qtify(), runMoc(), QmlIR::IRBuilder::signalNameFromSignalPropertyName(), QCss::StyleSelector::styleRulesForNode(), QCocoaMenuItem::sync(), toLower(), and QDateTimeEditPrivate::validateAndInterpret().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toLower() [2/2]

char32_t QChar::toLower ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.

Note
Before Qt 6, this function took a uint argument and returned uint.

Definition at line 1581 of file qchar.cpp.

References convertCase_helper(), and QUnicodeTables::LowerCase.

+ Here is the call graph for this function:

◆ toTitleCase() [1/2]

QChar QChar::toTitleCase ( ) const
inlinenoexcept

Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the character itself.

Definition at line 450 of file qchar.h.

References toTitleCase().

Referenced by toTitleCase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toTitleCase() [2/2]

char32_t QChar::toTitleCase ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.

Note
Before Qt 6, this function took a uint argument and returned uint.

Definition at line 1625 of file qchar.cpp.

References convertCase_helper(), and QUnicodeTables::TitleCase.

+ Here is the call graph for this function:

◆ toUpper() [1/2]

QChar QChar::toUpper ( ) const
inlinenoexcept

Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the character itself.

Definition at line 449 of file qchar.h.

References toUpper().

Referenced by CPP::WriteInitialization::acceptWidget(), QQmlPropertyCache::appendSignal(), QKeySequencePrivate::decodeString(), init_platform(), QQmlDelegateModelItemMetaType::initializeMetaObject(), QQmlDelegateModelItemMetaType::initializePrototype(), QKeySequencePrivate::keyName(), QKeySequence::mnemonic(), QQmlProperty::name(), qt_UCSConvertCase(), qtKey(), toKeyOrUnicode(), toUpper(), and tryDriveUNCFallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toUpper() [2/2]

char32_t QChar::toUpper ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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.

Note
Before Qt 6, this function took a uint argument and returned uint.

Definition at line 1603 of file qchar.cpp.

References convertCase_helper(), and QUnicodeTables::UpperCase.

+ Here is the call graph for this function:

◆ unicode() [1/2]

QChar::unicode ( ) const
inlineconstexprnoexcept

Returns the numeric Unicode value of the QChar.

Definition at line 458 of file qchar.h.

Referenced by QQmlJS::Dom::CommentInfo::CommentInfo(), addHexDigit(), QUrlPrivate::appendHost(), appendReplacementString(), QQuickTextInputPrivate::backspace(), convertHex(), QKeySequencePrivate::decodeString(), QPdfEnginePrivate::drawTextItem(), QTextEngine::elidedText(), encodeText(), findArgEscapes(), fontSizeSpec(), QTextStreamPrivate::getNumber(), QSettingsPrivate::iniUnescapedKey(), QFileSystemEntry::isAbsolute(), QXmlUtils::isEncName(), QmlIR::IRBuilder::isSignalPropertyName(), isSpecialKey(), macToQtFormat(), mangledIdentifier(), QV4::StringPrototype::method_charCodeAt(), QV4::StringPrototype::method_trim(), minimalPattern(), QTextLineItemIterator::next(), QStringIterator::next(), Recognizer::nextToken(), QStringIterator::nextUnchecked(), operator<<(), operator>>(), parseInt(), QQuickSvgParser::parsePathDataFast(), parsePathDataFast(), QStringIterator::previous(), QStringIterator::previousUnchecked(), qt_localizedName(), qt_punycodeDecoder(), QUrlQuery::query(), QUrlQueryPrivate::recodeFromUser(), QUrlQueryPrivate::recodeToUser(), QString::replace(), replaceArgEscapes(), QString::resize(), resolveColor(), QQmlJS::Lexer::scanRegExp(), QUrlPrivate::setAuthority(), QUrlQueryPrivate::setQuery(), QUrlPrivate::setScheme(), QTextBoundaryFinder::string(), QCommonStyle::styleHint(), QQC2::QCommonStyle::styleHint(), QRawFont::supportsCharacter(), QCocoaMenuItem::sync(), toInt(), toKeyOrUnicode(), QTextDocument::toPlainText(), tryDriveUNCFallback(), QTextOdfWriter::writeBlock(), xpmHash(), and QLocaleData::zeroUcs().

◆ unicode() [2/2]

QChar::unicode ( )
inlineconstexprnoexcept

Returns a reference to the numeric Unicode value of the QChar.

Definition at line 459 of file qchar.h.

◆ unicodeVersion() [1/2]

QChar::UnicodeVersion QChar::unicodeVersion ( ) const
inlinenoexcept

Returns the Unicode version that introduced this character.

Definition at line 455 of file qchar.h.

References unicodeVersion().

Referenced by decomposeHelper(), and unicodeVersion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unicodeVersion() [2/2]

QChar::UnicodeVersion QChar::unicodeVersion ( char32_t  ucs4)
staticnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the Unicode version that introduced the character specified in its UCS-4-encoded form as ucs4.

Note
Before Qt 6, this function took a uint argument.

Definition at line 1503 of file qchar.cpp.

References QUnicodeTables::qGetProp(), Unicode_Unassigned, and QUnicodeTables::Properties::unicodeVersion.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!= [1/3]

int QChar::operator!= ( QChar  c1,
QChar  c2 
)
friend

Returns true if c1 and c2 are not the same Unicode character; otherwise returns false.

Definition at line 585 of file qchar.h.

◆ operator!= [2/3]

constexpr bool operator!= ( QChar  lhs,
std::nullptr_t   
)
friend

Definition at line 595 of file qchar.h.

◆ operator!= [3/3]

constexpr bool operator!= ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 600 of file qchar.h.

◆ operator< [1/3]

int QChar::operator< ( QChar  c1,
QChar  c2 
)
friend

Returns true if the numeric Unicode value of c1 is less than that of c2; otherwise returns false.

Definition at line 583 of file qchar.h.

◆ operator< [2/3]

constexpr bool operator< ( QChar  ,
std::nullptr_t   
)
friend

Definition at line 591 of file qchar.h.

◆ operator< [3/3]

constexpr bool operator< ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 593 of file qchar.h.

◆ operator<<()

QDataStream & operator<< ( QDataStream out,
QChar  chr 
)
related

Writes the char chr to the stream out.

See also
{Serializing Qt Data Types}

Definition at line 1711 of file qchar.cpp.

References out, and unicode().

+ Here is the call graph for this function:

◆ operator<= [1/3]

int QChar::operator<= ( QChar  c1,
QChar  c2 
)
friend

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Definition at line 588 of file qchar.h.

◆ operator<= [2/3]

constexpr bool operator<= ( QChar  lhs,
std::nullptr_t   
)
friend

Definition at line 598 of file qchar.h.

◆ operator<= [3/3]

constexpr bool operator<= ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 603 of file qchar.h.

◆ operator== [1/3]

bool QChar::operator== ( QChar  c1,
QChar  c2 
)
friend

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Definition at line 582 of file qchar.h.

◆ operator== [2/3]

constexpr bool operator== ( QChar  lhs,
std::nullptr_t   
)
friend

Definition at line 590 of file qchar.h.

◆ operator== [3/3]

constexpr bool operator== ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 592 of file qchar.h.

◆ operator> [1/3]

int QChar::operator> ( QChar  c1,
QChar  c2 
)
friend

Returns true if the numeric Unicode value of c1 is greater than that of c2; otherwise returns false.

Definition at line 587 of file qchar.h.

◆ operator> [2/3]

constexpr bool operator> ( QChar  lhs,
std::nullptr_t   
)
friend

Definition at line 597 of file qchar.h.

◆ operator> [3/3]

constexpr bool operator> ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 602 of file qchar.h.

◆ operator>= [1/3]

int QChar::operator>= ( QChar  c1,
QChar  c2 
)
friend

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Definition at line 586 of file qchar.h.

◆ operator>= [2/3]

constexpr bool operator>= ( QChar  lhs,
std::nullptr_t   
)
friend

Definition at line 596 of file qchar.h.

◆ operator>= [3/3]

constexpr bool operator>= ( std::nullptr_t  ,
QChar  rhs 
)
friend

Definition at line 601 of file qchar.h.

◆ operator>>()

QDataStream & operator>> ( QDataStream in,
QChar chr 
)
related

Reads a char from the stream in into char chr.

See also
{Serializing Qt Data Types}

Definition at line 1724 of file qchar.cpp.

References unicode().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: