本文整理汇总了C++中QChar::decompositionTag方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::decompositionTag方法的具体用法?C++ QChar::decompositionTag怎么用?C++ QChar::decompositionTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::decompositionTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatCharacter
static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext &context)
{
const ushort unicode = qc.unicode();
str << "U+" << qSetFieldWidth(4) << qSetPadChar('0') << uppercasedigits << hex << unicode
<< dec << qSetFieldWidth(0) << ' ';
const EnumLookup *specialChar = enumLookup(unicode, specialCharactersEnumLookup, sizeof(specialCharactersEnumLookup) / sizeof(EnumLookup));
if (specialChar)
str << specialChar->description;
else
str << "'" << qc << '\'';
const int category = qc.category();
if (category != context.category) {
str << " category="
<< enumName(category, categoryEnumLookup, sizeof(categoryEnumLookup) / sizeof(EnumLookup));
context.category = category;
}
#if QT_VERSION >= 0x050100
const int script = qc.script();
if (script != context.script) {
str << " script="
<< enumName(script, scriptEnumLookup, sizeof(scriptEnumLookup) / sizeof(EnumLookup))
<< '(' << script << ')';
context.script = script;
}
#endif // Qt 5
const int direction = qc.direction();
if (direction != context.direction) {
str << " direction="
<< enumName(direction, directionEnumLookup, sizeof(directionEnumLookup) / sizeof(EnumLookup));
context.direction = direction;
}
#if QT_VERSION >= 0x050000
const int joiningType = qc.joiningType();
if (joiningType != context.joiningType) {
str << " joiningType="
<< enumName(joiningType, joiningTypeEnumLookup, sizeof(joiningTypeEnumLookup) / sizeof(EnumLookup));
context.joiningType = joiningType;
}
#endif // Qt 5QWidget
const int decompositionTag = qc.decompositionTag();
if (decompositionTag != context.decompositionTag) {
str << " decomposition="
<< enumName(decompositionTag, decompositionEnumLookup, sizeof(decompositionEnumLookup) / sizeof(EnumLookup));
context.decompositionTag = decompositionTag;
}
const int unicodeVersion = qc.unicodeVersion();
if (unicodeVersion != context.unicodeVersion) {
str << " version="
<< enumName(unicodeVersion, unicodeVersionEnumLookup, sizeof(unicodeVersionEnumLookup) / sizeof(EnumLookup));
context.unicodeVersion = unicodeVersion;
}
}
示例2: DividerKey
QString LibraryModel::DividerKey(GroupBy type, LibraryItem* item) const {
// Items which are to be grouped under the same divider must produce the
// same divider key. This will only get called for top-level items.
if (item->sort_text.isEmpty()) return QString();
switch (type) {
case GroupBy_Album:
case GroupBy_Artist:
case GroupBy_Composer:
case GroupBy_Performer:
case GroupBy_Disc:
case GroupBy_Grouping:
case GroupBy_Genre:
case GroupBy_AlbumArtist:
case GroupBy_FileType: {
QChar c = item->sort_text[0];
if (c.isDigit()) return "0";
if (c == ' ') return QString();
if (c.decompositionTag() != QChar::NoDecomposition)
return QChar(c.decomposition()[0]);
return c;
}
case GroupBy_Year:
case GroupBy_OriginalYear:
return SortTextForNumber(item->sort_text.toInt() / 10 * 10);
case GroupBy_YearAlbum:
return SortTextForNumber(item->metadata.year());
case GroupBy_OriginalYearAlbum:
return SortTextForNumber(item->metadata.effective_originalyear());
case GroupBy_Bitrate:
return SortTextForNumber(item->metadata.bitrate());
case GroupBy_None:
return QString();
}
qLog(Error) << "Unknown GroupBy type" << type << "for item"
<< item->display_text;
return QString();
}