21#include <private/qfontengine_p.h>
22#include <private/qpainter_p.h>
23#include <private/qtextengine_p.h>
26#include <qpa/qplatformscreen.h>
27#include <qpa/qplatformintegration.h>
28#include <qpa/qplatformfontdatabase.h>
29#include <QtGui/private/qguiapplication_p.h>
31#include <QtCore/QMutexLocker>
32#include <QtCore/QMutex>
37#ifdef QFONTCACHE_DEBUG
38# define FC_DEBUG qDebug
40# define FC_DEBUG if (false) qDebug
45#ifndef QFONTCACHE_DECREASE_TRIGGER_LIMIT
46# define QFONTCACHE_DECREASE_TRIGGER_LIMIT 256
85 QString this_family, this_foundry, other_family, other_foundry;
89 if (this_family != other_family || this_foundry != other_foundry)
100 && this_family == other_family
102 && (this_foundry.isEmpty()
103 || other_foundry.isEmpty()
104 || this_foundry == other_foundry)
148 static constexpr std::array<int, 2> legacyToOpenTypeMap[] = {
154 int closestDist = INT_MAX;
158 for (
auto mapping : legacyToOpenTypeMap) {
159 const int weightOld =
mapping[ inverted];
160 const int weightNew =
mapping[!inverted];
162 if (
dist < closestDist) {
181 const int numFamilies =
list.
size();
183 for (
int i = 0;
i < numFamilies; ++
i) {
209 capital(0), letterSpacingIsAbsolute(
false), scFont(
nullptr)
215 underline(
other.underline), overline(
other.overline),
217 capital(
other.capital), letterSpacingIsAbsolute(
other.letterSpacingIsAbsolute),
218 letterSpacing(
other.letterSpacing), wordSpacing(
other.wordSpacing),
219 features(
other.features), scFont(
other.scFont)
239#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engines[script]
244 if (script <= QChar::Script_Latin)
245 script = QChar::Script_Common;
392 for (
int i = 0;
i < QChar::ScriptCount; ++
i) {
622 : resolve_mask(
font.resolve_mask)
638 :
d(
data), resolve_mask(
QFont::AllPropertiesResolved)
799 resolve_mask =
font.resolve_mask;
988 qWarning(
"QFont::setPointSize: Point size <= 0 (%d), must be greater than 0",
pointSize);
1013 qWarning(
"QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0",
pointSize);
1157#if QT_DEPRECATED_SINCE(6, 0)
1173void QFont::setLegacyWeight(
int legacyWeight)
1191int QFont::legacyWeight()
const
1208 if (weightValue !=
static_cast<int>(
weight)) {
1209 qWarning() <<
"QFont::setWeight: Weight must be between 1 and 1000, attempted to set "
1210 <<
static_cast<int>(
weight);
1590 if (factor < 0 || factor > 4000) {
1591 qWarning(
"QFont::setStretch: Parameter '%d' out of range", factor);
1801 if (
f.d == d)
return false;
1805 if (
r1.pointSize !=
r2.pointSize)
return r1.pointSize <
r2.pointSize;
1806 if (
r1.pixelSize !=
r2.pixelSize)
return r1.pixelSize <
r2.pixelSize;
1807 if (
r1.weight !=
r2.weight)
return r1.weight <
r2.weight;
1808 if (
r1.style !=
r2.style)
return r1.style <
r2.style;
1809 if (
r1.stretch !=
r2.stretch)
return r1.stretch <
r2.stretch;
1810 if (
r1.styleHint !=
r2.styleHint)
return r1.styleHint <
r2.styleHint;
1811 if (
r1.styleStrategy !=
r2.styleStrategy)
return r1.styleStrategy <
r2.styleStrategy;
1812 if (
r1.families !=
r2.families)
return r1.families <
r2.families;
1819 int f1attrs = (
f.d->underline << 3) + (
f.d->overline << 2) + (
f.d->strikeOut<<1) +
f.d->kerning;
1821 if (f1attrs != f2attrs)
return f1attrs < f2attrs;
1828 auto jt =
f.d->features.constBegin();
1830 if (
it.key() != jt.key())
1831 return jt.key() <
it.key();
1832 if (
it.value() != jt.value())
1833 return jt.value() <
it.value();
1837 if (
r1.variableAxisValues.
size() !=
r2.variableAxisValues.
size())
1838 return r1.variableAxisValues.
size() <
r2.variableAxisValues.
size();
1841 auto it =
r1.variableAxisValues.constBegin();
1842 auto jt =
r2.variableAxisValues.constBegin();
1843 for (;
it !=
r1.variableAxisValues.constEnd(); ++
it, ++jt) {
1844 if (
it.key() != jt.key())
1845 return jt.key() <
it.key();
1846 if (
it.value() != jt.value())
1847 return jt.value() <
it.value();
1895 if (resolve_mask == 0 || (resolve_mask ==
other.resolve_mask && *
this ==
other)) {
1897 o.resolve_mask = resolve_mask;
1942 if (
it != fontSubst->
constEnd() && !(*it).isEmpty())
1943 return (*it).first();
1976 const QString &substituteName)
2003 for (
const QString &substituteName : substituteNames) {
2020 fontSubst->remove(familyName.
toLower());
2038#ifndef QT_NO_DATASTREAM
2047 if (
f->request.style)
2055 if (
f->request.fixedPitch)
2059 if (version >= QDataStream::Qt_4_0) {
2072 if (
f->request.ignorePitch)
2074 if (
f->letterSpacingIsAbsolute)
2087 f->underline = (
bits & 0x02) != 0;
2088 f->overline = (
bits & 0x40) != 0;
2089 f->strikeOut = (
bits & 0x04) != 0;
2090 f->request.fixedPitch = (
bits & 0x08) != 0;
2092 if (version >= QDataStream::Qt_4_0)
2093 f->kerning = (
bits & 0x10) != 0;
2094 if ((
bits & 0x80) != 0)
2101 f->request.ignorePitch = (
bits & 0x01) != 0;
2102 f->letterSpacingIsAbsolute = (
bits & 0x02) != 0;
2145 const QChar comma(u
',');
2167 return fontDescription;
2193 const auto l = sr.
split(u
',');
2194 const int count = l.size();
2196 l.first().isEmpty()) {
2197 qWarning(
"QFont::fromString: Invalid description '%s'",
2198 descrip.isEmpty() ?
"(empty)" : descrip.toLatin1().data());
2212 }
else if (
count >= 10) {
2213 if (l[2].
toInt() > 0)
2378 if (
view.size() != 4) {
2379 qWarning(
"The tag name must be exactly 4 characters long!");
2380 return std::nullopt;
2384 if constexpr (std::is_same_v<CharType, char>) {
2385 const char bytes[5] = {
view.at(0),
view.at(1),
view.at(2),
view.at(3), 0 };
2388 const char bytes[5] = {
view.at(0).toLatin1(),
view.at(1).toLatin1(),
2389 view.at(2).toLatin1(),
view.at(3).toLatin1(), 0 };
2393 return maybeTag.isValid() ? std::optional<Tag>(maybeTag) : std::nullopt;
2444 if (
tag.isValid()) {
2467 if (
tag.isValid()) {
2576 if (
tag.isValid()) {
2600 if (
tag.isValid()) {
2684 if (!fallbacks.isEmpty())
2685 return fallbacks.first();
2734#ifndef QT_NO_DATASTREAM
2746 if (
s.version() == 1) {
2750 if (
s.version() >= QDataStream::Qt_5_4)
2754 if (
s.version() >= QDataStream::Qt_4_0) {
2760 }
else if (
s.version() <= 3) {
2762 if (pointSize < 0) {
2772 if (
s.version() >= QDataStream::Qt_3_1) {
2775 if (
s.version() >= QDataStream::Qt_5_4)
2781 if (
s.version() < QDataStream::Qt_6_0)
2787 if (
s.version() >= QDataStream::Qt_4_3)
2789 if (
s.version() >= QDataStream::Qt_4_4)
2791 if (
s.version() >= QDataStream::Qt_4_5) {
2795 if (
s.version() >= QDataStream::Qt_5_4)
2797 if (
s.version() >= QDataStream::Qt_5_6)
2799 if (
s.version() >= QDataStream::Qt_5_13) {
2800 if (
s.version() < QDataStream::Qt_6_0)
2805 if (
s.version() >= QDataStream::Qt_6_6)
2807 if (
s.version() >= QDataStream::Qt_6_7)
2829 if (
s.version() == 1) {
2837 if (
s.version() >= QDataStream::Qt_5_4)
2841 if (
s.version() >= QDataStream::Qt_4_0) {
2850 qint16 pointSize, pixelSize = -1;
2852 if (
s.version() >= 4)
2858 if (
s.version() >= QDataStream::Qt_3_1) {
2859 if (
s.version() >= QDataStream::Qt_5_4) {
2862 quint8 tempStyleStrategy;
2863 s >> tempStyleStrategy;
2864 styleStrategy = tempStyleStrategy;
2868 if (
s.version() < QDataStream::Qt_6_0) {
2887 if (
s.version() >= QDataStream::Qt_4_3) {
2893 if (
s.version() >= QDataStream::Qt_4_4) {
2898 if (
s.version() >= QDataStream::Qt_4_5) {
2905 if (
s.version() >= QDataStream::Qt_5_4) {
2910 if (
s.version() >= QDataStream::Qt_5_6) {
2915 if (
s.version() >= QDataStream::Qt_5_13) {
2918 if (
s.version() < QDataStream::Qt_6_0)
2923 if (
s.version() >= QDataStream::Qt_6_6) {
2927 if (
s.version() >= QDataStream::Qt_6_7) {
2948 stream.setStatus(QDataStream::ReadCorruptData);
3096 return engine->fontDef.families.isEmpty() ?
QString() :
engine->fontDef.families.constFirst();
3111 return engine->fontDef.styleName;
3135 return engine->fontDef.pointSize;
3147 return engine->fontDef.pixelSize;
3175#if QT_DEPRECATED_SINCE(6, 0)
3189int QFontInfo::legacyWeight()
const
3205 return engine->fontDef.weight;
3271 if (!
engine->fontDef.fixedPitchComputed) {
3273 QGlyphLayoutArray<2>
g;
3275 if (
engine->stringToCMap(
ch, 2, &
g, &l, {}) < 0)
3278 engine->fontDef.fixedPitch =
g.advances[0] ==
g.advances[1];
3279 engine->fontDef.fixedPitchComputed =
true;
3282 return engine->fontDef.fixedPitch;
3319using namespace std::chrono_literals;
3321#ifdef QFONTCACHE_DEBUG
3330#ifndef QFONTCACHE_MIN_COST
3331# define QFONTCACHE_MIN_COST 4*1024
3338 QFontCache *&fontCache = theFontCache()->localData();
3346 QThreadStorage<QFontCache *> *
cache =
nullptr;
3348 cache = theFontCache();
3349 }
QT_CATCH (
const std::bad_alloc &) {
3353 cache->setLocalData(
nullptr);
3359 :
QObject(), total_cost(0), max_cost(min_cost),
3360 current_timestamp(0), fast(
false),
3380 for (
int i = 0;
i < QChar::ScriptCount; ++
i) {
3381 if (
data->engines[
i]) {
3382 if (!
data->engines[
i]->ref.deref()) {
3384 delete data->engines[
i];
3386 data->engines[
i] =
nullptr;
3389 if (!
data->ref.deref()) {
3392 FC_DEBUG(
"QFontCache::clear: engineData %p still has refcount %d",
3402 bool mightHaveEnginesLeftForCleanup;
3404 mightHaveEnginesLeftForCleanup =
false;
3411 if (!
engine->ref.deref()) {
3415 }
else if (cacheCount == 0) {
3416 FC_DEBUG(
"QFontCache::clear: engine %p still has refcount %d",
3419 it.value().data =
nullptr;
3422 }
while (mightHaveEnginesLeftForCleanup);
3429 max_cost = min_cost;
3445#ifdef QFONTCACHE_DEBUG
3446 FC_DEBUG(
"QFontCache: inserting new engine data %p", engineData);
3448 FC_DEBUG(
" QFontCache already contains engine data %p for key=(%g %g %d %d %d)",
3468 if (
it ==
end)
return nullptr;
3476 return it.value().data;
3482 value.timestamp = ++current_timestamp;
3484 FC_DEBUG(
"QFontCache: found font engine\n"
3485 " %p: timestamp %4u hits %3u ref %2d/%2d, type %d",
3488 value.data->type());
3496#ifdef QFONTCACHE_DEBUG
3497 FC_DEBUG(
"QFontCache: inserting new engine %p, refcount %d",
engine,
engine->ref.loadRelaxed());
3499 FC_DEBUG(
" QFontCache already contains engine %p for key=(%g %g %d %d %d)",
3501 key.def.pixelSize,
key.def.weight,
key.def.style,
key.def.fixedPitch);
3510 data.timestamp = ++current_timestamp;
3518 increaseCost(
engine->cache_cost);
3521void QFontCache::increaseCost(
uint cost)
3527 FC_DEBUG(
" COST: increased %u kb, total_cost %u kb, max_cost %u kb",
3528 cost, total_cost, max_cost);
3530 if (total_cost > max_cost) {
3531 max_cost = total_cost;
3536 if (timer_id == -1 || ! fast) {
3547void QFontCache::decreaseCost(
uint cost)
3554 FC_DEBUG(
" COST: decreased %u kb, total_cost %u kb, max_cost %u kb",
3555 cost, total_cost, max_cost);
3560 FC_DEBUG(
"QFontCache::timerEvent: performing cache maintenance (timestamp %u)",
3563 if (total_cost <= max_cost && max_cost <= min_cost) {
3564 FC_DEBUG(
" cache redused sufficiently, stopping timer");
3575void QFontCache::decreaseCache()
3578 uint in_use_cost = 0;
3584 const uint engine_data_cost =
3590 FC_DEBUG(
" %p: ref %2d",
it.value(),
int(
it.value()->ref.loadRelaxed()));
3592 if (
it.value()->ref.loadRelaxed() != 1)
3593 in_use_cost += engine_data_cost;
3603 FC_DEBUG(
" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes",
3604 it.value().data,
it.value().timestamp,
it.value().hits,
3606 it.value().data->cache_cost);
3616 in_use_cost = (in_use_cost + 512) / 1024;
3626 uint new_max_cost =
qMax(
qMax(max_cost / 2, in_use_cost), min_cost);
3628 FC_DEBUG(
" after sweep, in use %u kb, total %u kb, max %u kb, new max %u kb",
3629 in_use_cost, total_cost, max_cost, new_max_cost);
3632 if (new_max_cost == max_cost) {
3634 FC_DEBUG(
" cannot shrink cache, slowing timer");
3636 if (timer_id != -1) {
3643 }
else if (! fast) {
3644 FC_DEBUG(
" dropping into passing gear");
3653 max_cost = new_max_cost;
3661 if (
it.value()->ref.loadRelaxed() == 1) {
3664 it.value()->ref.deref();
3676 bool cost_decreased;
3678 cost_decreased =
false;
3684 uint least_popular = ~0u;
3692 if (
it.value().timestamp < oldest &&
it.value().hits <= least_popular) {
3693 oldest =
it.value().timestamp;
3694 least_popular =
it.value().hits;
3701 FC_DEBUG(
" %p: timestamp %4u hits %2u ref %2d/%2d, type %d",
3702 it.value().data,
it.value().timestamp,
it.value().hits,
3704 it.value().data->type());
3710 if (
it.value().data == fontEngine) {
3723 cost_decreased =
true;
3725 }
while (cost_decreased && total_cost > max_cost);
3729#ifndef QT_NO_DEBUG_STREAM
3733 stream.nospace().noquote();
3736 if (
stream.verbosity() == QDebug::DefaultVerbosity) {
3748 const bool resolved = (
font.resolve_mask &
property) != 0;
3749 if (!resolved &&
stream.verbosity() == QDebug::MinimumVerbosity)
3752 #define QFONT_DEBUG_SKIP_DEFAULT(prop) \
3753 if ((font.prop() == defaultFont.prop()) && stream.verbosity() == 1) \
3814 #undef QFONT_DEBUG_SKIP_DEFAULT
3819 if (
stream.verbosity() > QDebug::MinimumVerbosity)
3820 debug.verbosity(0) <<
"resolveMask=" << QFlags<QFont::ResolveProperties>(
font.resolve_mask);
3822 fontDescription.chop(2);
3824 stream << fontDescription <<
')';
3839#include "moc_qfont.cpp"
T loadRelaxed() const noexcept
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
\inmodule QtCore\reentrant
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
T * data() const noexcept
Returns a pointer to the shared data object.
void insertEngineData(const QFontDef &def, QFontEngineData *engineData)
EngineDataCache engineDataCache
QFontEngine * findEngine(const Key &key)
QFontEngineData * findEngineData(const QFontDef &def) const
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
static QFontCache * instance()
void updateHitCountAndTimeStamp(Engine &value)
void insertEngine(const Key &key, QFontEngine *engine, bool insertMulti=false)
QHash< QFontEngine *, int > engineCacheCount
static void parseFontName(const QString &name, QString &foundry, QString &family)
static void load(const QFontPrivate *d, int script)
QFontEngine * engines[QChar::ScriptCount]
qreal pointSizeF() const
Returns the point size of the matched window system font.
int pointSize() const
Returns the point size of the matched window system font.
int pixelSize() const
Returns the pixel size of the matched window system font.
QString family() const
Returns the family name of the matched window system font.
bool italic() const
Returns the italic value of the matched window system font.
QFontInfo & operator=(const QFontInfo &)
Assigns the font info in fi.
QString styleName() const
bool fixedPitch() const
Returns the fixed pitch value of the matched window system font.
QFontInfo(const QFont &)
Constructs a font info object for font.
QFont::StyleHint styleHint() const
Returns the style of the matched window system font.
bool strikeOut() const
Returns the strikeout value of the matched window system font.
bool overline() const
Returns the overline value of the matched window system font.
QFont::Style style() const
Returns the style value of the matched window system font.
int weight() const
Returns the weight of the matched window system font.
~QFontInfo()
Destroys the font info object.
bool exactMatch() const
Returns true if the matched window system font is exactly the same as the one specified by the font; ...
bool underline() const
Returns the underline value of the matched window system font.
void unsetFeature(QFont::Tag tag)
bool letterSpacingIsAbsolute
static QFontPrivate * get(const QFont &font)
QFontPrivate * smallCapsFontPrivate() const
bool hasVariableAxis(QFont::Tag tag, float value) const
QFontEngine * engineForScript(int script) const
void resolve(uint mask, const QFontPrivate *other)
void unsetVariableAxis(QFont::Tag tag)
void setFeature(QFont::Tag tag, quint32 value)
QFontEngineData * engineData
void setVariableAxis(QFont::Tag tag, float value)
QHash< QFont::Tag, quint32 > features
void alterCharForCapitalization(QChar &c) const
static void detachButKeepEngineData(QFont *font)
static QStringList substitutes(const QString &)
Returns a list of family names to be used whenever familyName is specified.
StyleHint
Style hints are used by the \l{QFont}{font matching} algorithm to find an appropriate default family ...
void setStyle(Style style)
Sets the style of the font to style.
QString family() const
Returns the requested font family name.
StyleStrategy styleStrategy() const
Returns the StyleStrategy.
void setPointSize(int)
Sets the point size to pointSize.
static void cacheStatistics()
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
QString styleName() const
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
bool isCopyOf(const QFont &) const
Returns true if this font and f are copies of each other, i.e.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
bool italic() const
Returns true if the style() of the font is not QFont::StyleNormal.
QFont()
Constructs a font object that uses the application's default font.
friend class QFontPrivate
StyleHint styleHint() const
Returns the StyleHint.
bool fromString(const QString &)
Sets this font to match the description descrip.
bool strikeOut() const
Returns true if strikeout has been set; otherwise returns false.
size_t qHash(const QFont &font, size_t seed) noexcept
Returns the hash value for font.
bool underline() const
Returns true if underline has been set; otherwise returns false.
void setFamilies(const QStringList &)
bool operator!=(const QFont &) const
Returns true if this font is different from f; otherwise returns false.
void setCapitalization(Capitalization)
QString toString() const
Returns a description of the font.
qreal letterSpacing() const
void setWordSpacing(qreal spacing)
void setFixedPitch(bool)
If enable is true, sets fixed pitch on; otherwise sets fixed pitch off.
void setFamily(const QString &)
Sets the family name of the font.
void setStyleStrategy(StyleStrategy s)
Sets the style strategy for the font to s.
bool exactMatch() const
Returns true if a window system font exactly matching the settings of this font is available.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
static void insertSubstitution(const QString &, const QString &)
Inserts substituteName into the substitution table for the family familyName.
bool isVariableAxisSet(Tag tag) const
HintingPreference hintingPreference() const
quint32 featureValue(Tag tag) const
QList< Tag > featureTags() const
bool operator<(const QFont &) const
Provides an arbitrary comparison of this font and font f.
Capitalization capitalization() const
static void removeSubstitutions(const QString &)
Removes all the substitutions for familyName.
QList< Tag > variableAxisTags() const
QStringList families() const
Weight weight() const
Returns the weight of the font, using the same scale as the \l{QFont::Weight} enumeration.
@ HintingPreferenceResolved
void setLetterSpacing(SpacingType type, qreal spacing)
void unsetVariableAxis(Tag tag)
qreal wordSpacing() const
int pointSize() const
Returns the point size of the font.
void setKerning(bool)
Enables kerning for this font if enable is true; otherwise disables it.
int stretch() const
Returns the stretch factor for the font.
static QStringList substitutions()
Returns a sorted list of substituted family names.
bool kerning() const
Returns true if kerning should be used when drawing text with this font.
QString defaultFamily() const
Returns the family name that corresponds to the current style hint.
QString key() const
Returns the font's key, a textual representation of a font.
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
bool isFeatureSet(Tag tag) const
bool operator==(const QFont &) const
Returns true if this font is equal to f; otherwise returns false.
void setHintingPreference(HintingPreference hintingPreference)
void setItalic(bool b)
Sets the style() of the font to QFont::StyleItalic if enable is true; otherwise the style is set to Q...
bool fixedPitch() const
Returns true if fixed pitch has been set; otherwise returns false.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
void setStyleHint(StyleHint, StyleStrategy=PreferDefault)
Sets the style hint and strategy to hint and strategy, respectively.
void unsetFeature(Tag tag)
QFont & operator=(const QFont &)
Move-assigns other to this QFont instance.
void setVariableAxis(Tag tag, float value)
qreal pointSizeF() const
Returns the point size of the font.
void setStyleName(const QString &)
void setStretch(int)
Sets the stretch factor for the font.
SpacingType letterSpacingType() const
void setFeature(Tag tag, quint32 value)
Stretch
Predefined stretch values that follow the CSS naming convention.
Style style() const
Returns the style of the font.
StyleStrategy
The style strategy tells the \l{QFont}{font matching} algorithm what type of fonts should be used to ...
void setPointSizeF(qreal)
Sets the point size to pointSize.
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
float variableAxisValue(Tag tag) const
void setWeight(Weight weight)
Sets the weight of the font to weight, using the scale defined by \l QFont::Weight enumeration.
bool overline() const
Returns true if overline has been set; otherwise returns false.
~QFont()
Destroys the font object and frees all allocated resources.
Style
This enum describes the different styles of glyphs that are used to display text.
static void insertSubstitutions(const QString &, const QStringList &)
Inserts the list of families substituteNames into the substitution list for familyName.
QScreen * primaryScreen
the primary (or default) screen of the application.
bool remove(const Key &key)
Removes the item that has the key from the hash.
qsizetype size() const noexcept
Returns the number of items in the hash.
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
iterator insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue=T()) const
iterator erase(const_iterator it)
bool contains(const Key &key) const
size_type remove(const Key &key)
const_iterator constFind(const Key &key) const
QList< Key > keys() const
const_iterator ConstIterator
const_iterator constBegin() const
const_iterator constEnd() const
iterator replace(const Key &key, const T &value)
const_iterator constEnd() const
bool contains(const Key &key) const
const_iterator ConstIterator
iterator find(const Key &key)
iterator insert(const Key &key, const T &value)
iterator erase(const_iterator it)
const_iterator constBegin() const
T value(const Key &key, const T &defaultValue=T()) const
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
void killTimer(int id)
Kills the timer with timer identifier, id.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
The QScreen class is used to query screen properties. \inmodule QtGui.
qreal logicalDotsPerInchY
the number of logical dots or pixels per inch in the vertical direction
qreal logicalDotsPerInchX
the number of logical dots or pixels per inch in the horizontal direction
const_iterator constEnd() const noexcept
const_iterator constFind(const T &value) const
Q_CORE_EXPORT QList< QStringView > split(QStringView sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the view into substring views wherever sep occurs, and returns the list of those string views.
QStringView trimmed() const noexcept
Strips leading and trailing whitespace and returns the result.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const noexcept
Returns the number of characters in this string.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
QString toLower() const &
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QList< QString > QStringList
Constructs a string list that contains the given string, str.
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
int qRound(qfloat16 d) noexcept
Q_GUI_EXPORT int qt_openTypeToLegacyWeight(int weight)
static void set_font_bits(int version, quint8 bits, QFontPrivate *f)
QRecursiveMutex * qt_fontdatabase_mutex()
static int convertWeights(int weight, bool inverted)
Q_GUI_EXPORT int qt_defaultDpiX()
static QStringList splitIntoFamilies(const QString &family)
Q_GUI_EXPORT int qt_legacyToOpenTypeWeight(int weight)
Q_GUI_EXPORT int qt_defaultDpi()
static constexpr auto slow_timeout
QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
static constexpr auto fast_timeout
#define QFONT_DEBUG_SKIP_DEFAULT(prop)
#define QFONTCACHE_MIN_COST
#define QT_FONT_ENGINE_FROM_DATA(data, script)
Q_GUI_EXPORT int qt_defaultDpiY()
static quint8 get_extended_font_bits(const QFontPrivate *f)
static Q_CONSTINIT QBasicAtomicInt font_cache_id
#define QFONTCACHE_DECREASE_TRIGGER_LIMIT
QDataStream & operator>>(QDataStream &stream, QFont::Tag &tag)
QDataStream & operator<<(QDataStream &stream, QFont::Tag tag)
QHash< QString, QStringList > QFontSubst
static quint8 get_font_bits(int version, const QFontPrivate *f)
static void set_extended_font_bits(quint8 bits, QFontPrivate *f)
static QStringList familyList(const QFontDef &req)
static QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint GLfloat weight
GLenum const void GLbitfield fontStyle
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLenum GLenum GLenum GLenum mapping
static qsizetype cost(const QPixmap &pixmap)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
static int toInt(const QChar &qc, int R)
static double toDouble(Value v)
std::uniform_real_distribution dist(1, 2.5)
[2]
QNetworkRequest request(url)
static constexpr QFixed fromReal(qreal r)
constexpr int value() const
constexpr qreal toReal() const
QMap< QFont::Tag, float > variableAxisValues
bool exactMatch(const QFontDef &other) const
The QFont::Tag type provides access to advanced font features.
static Q_GUI_EXPORT std::optional< Tag > fromString(QAnyStringView view) noexcept
Returns a tag constructed from the string in view.
static constexpr std::optional< Tag > fromValue(quint32 value) noexcept
Returns a tag constructed from value, or std::nullopt if the tag produced would be invalid.
bool contains(const AT &t) const noexcept