7#include <QtCore/qcompare.h>
8#include <QtCore/qendian.h>
9#include <QtCore/qshareddata.h>
10#include <QtGui/qtguiglobal.h>
11#include <QtGui/qwindowdefs.h>
12#include <QtCore/qstring.h>
26 Helvetica, SansSerif = Helvetica,
28 Courier, TypeWriter = Courier,
29 OldEnglish, Decorative = OldEnglish,
39 PreferDefault = 0x0001,
40 PreferBitmap = 0x0002,
41 PreferDevice = 0x0004,
42 PreferOutline = 0x0008,
43 ForceOutline = 0x0010,
45 PreferQuality = 0x0040,
46 PreferAntialias = 0x0080,
48 NoSubpixelAntialias = 0x0800,
49 PreferNoShaping = 0x1000,
50 ContextFontMerging = 0x2000,
51 PreferTypoLineMetrics = 0x4000,
52 NoFontMerging = 0x8000
56 enum HintingPreference {
57 PreferDefaultHinting = 0,
59 PreferVerticalHinting = 2,
62 Q_ENUM(HintingPreference)
105 Q_ENUM(Capitalization)
113 enum ResolveProperties {
114 NoPropertiesResolved = 0x0000,
115 FamilyResolved = 0x0001,
116 SizeResolved = 0x0002,
117 StyleHintResolved = 0x0004,
118 StyleStrategyResolved = 0x0008,
119 WeightResolved = 0x0010,
120 StyleResolved = 0x0020,
121 UnderlineResolved = 0x0040,
122 OverlineResolved = 0x0080,
123 StrikeOutResolved = 0x0100,
124 FixedPitchResolved = 0x0200,
125 StretchResolved = 0x0400,
126 KerningResolved = 0x0800,
127 CapitalizationResolved = 0x1000,
128 LetterSpacingResolved = 0x2000,
129 WordSpacingResolved = 0x4000,
130 HintingPreferenceResolved = 0x8000,
131 StyleNameResolved = 0x10000,
132 FamiliesResolved = 0x20000,
133 FeaturesResolved = 0x40000,
134 VariableAxesResolved = 0x80000,
135 AllPropertiesResolved = 0xfffff
137 Q_ENUM(ResolveProperties)
141 QFont(
const QString &family,
int pointSize = -1,
int weight = -1,
bool italic =
false);
142 explicit QFont(
const QStringList &families,
int pointSize = -1,
int weight = -1,
bool italic =
false);
143 QFont(
const QFont &font,
const QPaintDevice *pd);
144 QFont(
const QFont &font);
147 void swap(QFont &other)
noexcept
148 { d.swap(other.d); std::swap(resolve_mask, other.resolve_mask); }
150 QString family()
const;
151 void setFamily(
const QString &);
153 QStringList families()
const;
154 void setFamilies(
const QStringList &);
156 QString styleName()
const;
157 void setStyleName(
const QString &);
159 int pointSize()
const;
160 void setPointSize(
int);
161 qreal pointSizeF()
const;
162 void setPointSizeF(qreal);
164 int pixelSize()
const;
165 void setPixelSize(
int);
167 Weight weight()
const;
168 void setWeight(Weight weight);
170 inline bool bold()
const;
171 inline void setBold(
bool);
173 void setStyle(Style style);
176 inline bool italic()
const;
177 inline void setItalic(
bool b);
179 bool underline()
const;
180 void setUnderline(
bool);
182 bool overline()
const;
183 void setOverline(
bool);
185 bool strikeOut()
const;
186 void setStrikeOut(
bool);
188 bool fixedPitch()
const;
189 void setFixedPitch(
bool);
191 bool kerning()
const;
192 void setKerning(
bool);
194 StyleHint styleHint()
const;
195 StyleStrategy styleStrategy()
const;
196 void setStyleHint(StyleHint, StyleStrategy = PreferDefault);
197 void setStyleStrategy(StyleStrategy s);
200 void setStretch(
int);
202 qreal letterSpacing()
const;
203 SpacingType letterSpacingType()
const;
204 void setLetterSpacing(SpacingType type, qreal spacing);
206 qreal wordSpacing()
const;
207 void setWordSpacing(qreal spacing);
209 void setCapitalization(Capitalization);
210 Capitalization capitalization()
const;
212 void setHintingPreference(HintingPreference hintingPreference);
213 HintingPreference hintingPreference()
const;
217 constexpr Tag() =
default;
220 constexpr Q_IMPLICIT Tag(
const char (&str)[N])
noexcept
221 : m_value((quint32(str[0]) << 24) | (quint32(str[1]) << 16)
222 | (quint32(str[2]) << 8) | quint32(str[3]))
224 static_assert(N == 5,
"The tag name must be exactly 4 characters long!");
227 constexpr bool isValid()
const noexcept {
return m_value != 0; }
228 constexpr quint32 value()
const noexcept {
return m_value; }
230 QByteArray toString()
const
232 const char data[] = {
233 char((m_value & 0xff000000) >> 24),
234 char((m_value & 0x00ff0000) >> 16),
235 char((m_value & 0x0000ff00) >> 8),
236 char((m_value & 0x000000ff)) };
237 return QByteArray(data,
sizeof(data));
240 static constexpr std::optional<Tag> fromValue(quint32 value)
noexcept
243 maybeTag.m_value = value;
244 return maybeTag.isValid() ? std::optional<Tag>(maybeTag) : std::nullopt;
246 Q_GUI_EXPORT
static std::optional<Tag> fromString(QAnyStringView view)
noexcept;
248#ifndef QT_NO_DATASTREAM
249 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, Tag);
250 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, Tag &);
253#ifndef QT_NO_DEBUG_STREAM
254 friend Q_GUI_EXPORT QDebug operator<<(QDebug debug, Tag tag);
257 friend constexpr size_t qHash(Tag key, size_t seed = 0)
noexcept
258 {
return qHash(key.value(), seed); }
261 friend constexpr bool comparesEqual(
const Tag &lhs,
const Tag &rhs)
noexcept
262 {
return lhs.m_value == rhs.m_value; }
263 friend constexpr Qt::strong_ordering compareThreeWay(
const Tag &lhs,
const Tag &rhs)
noexcept
264 {
return Qt::compareThreeWay(lhs.m_value, rhs.m_value); }
265 Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QFont::Tag)
270 void setFeature(Tag tag, quint32 value);
271 void unsetFeature(Tag tag);
272 quint32 featureValue(Tag tag)
const;
273 bool isFeatureSet(Tag tag)
const;
274 QList<Tag> featureTags()
const;
275 void clearFeatures();
277 void setVariableAxis(Tag tag,
float value);
278 void unsetVariableAxis(Tag tag);
279 bool isVariableAxisSet(Tag tag)
const;
280 float variableAxisValue(Tag tag)
const;
281 void clearVariableAxes();
282 QList<Tag> variableAxisTags()
const;
285 bool exactMatch()
const;
287 QFont &operator=(
const QFont &);
288 bool operator==(
const QFont &)
const;
289 bool operator!=(
const QFont &)
const;
290 bool operator<(
const QFont &)
const;
291 operator QVariant()
const;
292 bool isCopyOf(
const QFont &)
const;
293 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFont)
297 QString toString()
const;
298 bool fromString(
const QString &);
300 static QString substitute(
const QString &);
301 static QStringList substitutes(
const QString &);
302 static QStringList substitutions();
303 static void insertSubstitution(
const QString&,
const QString &);
304 static void insertSubstitutions(
const QString&,
const QStringList &);
305 static void removeSubstitutions(
const QString &);
306 static void initialize();
307 static void cleanup();
308 static void cacheStatistics();
310 QString defaultFamily()
const;
312 QFont resolve(
const QFont &)
const;
313 inline uint resolveMask()
const {
return resolve_mask; }
314 inline void setResolveMask(uint mask) { resolve_mask = mask; }
316#if QT_DEPRECATED_SINCE(6
, 0
)
317 QT_DEPRECATED_VERSION_X_6_0(
"Use setWeight() instead")
void setLegacyWeight(
int legacyWeight);
318 QT_DEPRECATED_VERSION_X_6_0(
"Use weight() instead")
int legacyWeight()
const;
322 explicit QFont(QFontPrivate *);
327 friend class QFontPrivate;
328 friend class QFontDialogPrivate;
329 friend class QFontMetrics;
330 friend class QFontMetricsF;
331 friend class QFontInfo;
332 friend class QPainter;
333 friend class QPainterPrivate;
334 friend class QApplication;
335 friend class QWidget;
336 friend class QWidgetPrivate;
337 friend class QTextLayout;
338 friend class QTextEngine;
339 friend class QStackTextEngine;
340 friend class QTextLine;
341 friend struct QScriptLine;
342 friend class QOpenGLContext;
343 friend class QWin32PaintEngine;
344 friend class QAlphaPaintEngine;
345 friend class QPainterPath;
346 friend class QTextItemInt;
347 friend class QPicturePaintEngine;
348 friend class QPainterReplayer;
349 friend class QPaintBufferEngine;
350 friend class QCommandLinkButtonPrivate;
351 friend class QFontEngine;
353#ifndef QT_NO_DATASTREAM
354 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QFont &);
355 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QFont &);
358#ifndef QT_NO_DEBUG_STREAM
359 friend Q_GUI_EXPORT QDebug operator<<(QDebug,
const QFont &);
362 QExplicitlySharedDataPointer<QFontPrivate> d;
368Q_GUI_EXPORT size_t qHash(
const QFont &font, size_t seed = 0)
noexcept;
370inline bool QFont::bold()
const
371{
return weight() > Medium; }
374inline void QFont::setBold(
bool enable)
375{ setWeight(enable ? Bold : Normal); }
377inline bool QFont::italic()
const
379 return (style() != StyleNormal);
382inline void QFont::setItalic(
bool b) {
383 setStyle(b ? StyleItalic : StyleNormal);
388
389
391#ifndef QT_NO_DATASTREAM
392Q_GUI_EXPORT
QDataStream &operator<<(QDataStream &,
const QFont &);
396#ifndef QT_NO_DEBUG_STREAM
397Q_GUI_EXPORT
QDebug operator<<(QDebug,
const QFont &);
The QClipboard class provides access to the window system clipboard.
\inmodule QtCore\reentrant
The QIcon class provides scalable icons in different modes and states.
The QPalette class contains color groups for each widget state.
The QStyleHints class contains platform specific hints and settings. \inmodule QtGui.
Combined button and popup list for selecting options.
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
static bool needsWindowBlockedEvent(const QWindow *w)
Q_CORE_EXPORT void qt_call_post_routines()
static void init_plugins(const QList< QByteArray > &pluginList)
static void initFontUnlocked()
static void clearFontUnlocked()
void qRegisterGuiVariant()
static Q_CONSTINIT unsigned applicationResourceFlags
static Q_CONSTINIT int touchDoubleTapDistance
static QWindowGeometrySpecification windowGeometrySpecification
static bool qt_detectRTLLanguage()
static bool checkNeedPortalSupport()
Q_CONSTINIT Q_GUI_EXPORT bool qt_is_tty_app
static Q_CONSTINIT bool force_reverse
static Q_CONSTINIT int mouseDoubleClickDistance
#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
static void initThemeHints()
static int nextGeometryToken(const QByteArray &a, int &pos, char *op)
#define CHECK_QAPP_INSTANCE(...)
@ ApplicationFontExplicitlySet
static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
void applyTo(QWindow *window) const
static QWindowGeometrySpecification fromArgument(const QByteArray &a)