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>
27 Helvetica, SansSerif = Helvetica,
29 Courier, TypeWriter = Courier,
30 OldEnglish, Decorative = OldEnglish,
40 PreferDefault = 0x0001,
41 PreferBitmap = 0x0002,
42 PreferDevice = 0x0004,
43 PreferOutline = 0x0008,
44 ForceOutline = 0x0010,
46 PreferQuality = 0x0040,
47 PreferAntialias = 0x0080,
49 NoSubpixelAntialias = 0x0800,
50 PreferNoShaping = 0x1000,
51 ContextFontMerging = 0x2000,
52 PreferTypoLineMetrics = 0x4000,
53 NoFontMerging = 0x8000
57 enum HintingPreference {
58 PreferDefaultHinting = 0,
60 PreferVerticalHinting = 2,
63 Q_ENUM(HintingPreference)
106 Q_ENUM(Capitalization)
114 enum ResolveProperties {
115 NoPropertiesResolved = 0x0000,
116 FamilyResolved = 0x0001,
117 SizeResolved = 0x0002,
118 StyleHintResolved = 0x0004,
119 StyleStrategyResolved = 0x0008,
120 WeightResolved = 0x0010,
121 StyleResolved = 0x0020,
122 UnderlineResolved = 0x0040,
123 OverlineResolved = 0x0080,
124 StrikeOutResolved = 0x0100,
125 FixedPitchResolved = 0x0200,
126 StretchResolved = 0x0400,
127 KerningResolved = 0x0800,
128 CapitalizationResolved = 0x1000,
129 LetterSpacingResolved = 0x2000,
130 WordSpacingResolved = 0x4000,
131 HintingPreferenceResolved = 0x8000,
132 StyleNameResolved = 0x10000,
133 FamiliesResolved = 0x20000,
134 FeaturesResolved = 0x40000,
135 VariableAxesResolved = 0x80000,
136 AllPropertiesResolved = 0xfffff
138 Q_ENUM(ResolveProperties)
142 QFont(
const QString &family,
int pointSize = -1,
int weight = -1,
bool italic =
false);
143 explicit QFont(
const QStringList &families,
int pointSize = -1,
int weight = -1,
bool italic =
false);
144 QFont(
const QFont &font,
const QPaintDevice *pd);
145 QFont(
const QFont &font);
146 QFont(QFont &&) =
default;
149 void swap(QFont &other)
noexcept
150 { d.swap(other.d); std::swap(resolve_mask, other.resolve_mask); }
152 QString family()
const;
153 void setFamily(
const QString &);
155 QStringList families()
const;
156 void setFamilies(
const QStringList &);
158 QString styleName()
const;
159 void setStyleName(
const QString &);
161 int pointSize()
const;
162 void setPointSize(
int);
163 qreal pointSizeF()
const;
164 void setPointSizeF(qreal);
166 int pixelSize()
const;
167 void setPixelSize(
int);
169 Weight weight()
const;
170 void setWeight(Weight weight);
172 inline bool bold()
const;
173 inline void setBold(
bool);
175 void setStyle(Style style);
178 inline bool italic()
const;
179 inline void setItalic(
bool b);
181 bool underline()
const;
182 void setUnderline(
bool);
184 bool overline()
const;
185 void setOverline(
bool);
187 bool strikeOut()
const;
188 void setStrikeOut(
bool);
190 bool fixedPitch()
const;
191 void setFixedPitch(
bool);
193 bool kerning()
const;
194 void setKerning(
bool);
196 StyleHint styleHint()
const;
197 StyleStrategy styleStrategy()
const;
198 void setStyleHint(StyleHint, StyleStrategy = PreferDefault);
199 void setStyleStrategy(StyleStrategy s);
202 void setStretch(
int);
204 qreal letterSpacing()
const;
205 SpacingType letterSpacingType()
const;
206 void setLetterSpacing(SpacingType type, qreal spacing);
208 qreal wordSpacing()
const;
209 void setWordSpacing(qreal spacing);
211 void setCapitalization(Capitalization);
212 Capitalization capitalization()
const;
214 void setHintingPreference(HintingPreference hintingPreference);
215 HintingPreference hintingPreference()
const;
219 constexpr Tag() =
default;
222 constexpr Q_IMPLICIT Tag(
const char (&str)[N])
noexcept
223 : m_value((quint32(str[0]) << 24) | (quint32(str[1]) << 16)
224 | (quint32(str[2]) << 8) | quint32(str[3]))
226 static_assert(N == 5,
"The tag name must be exactly 4 characters long!");
229 constexpr bool isValid()
const noexcept {
return m_value != 0; }
230 constexpr quint32 value()
const noexcept {
return m_value; }
232 QByteArray toString()
const
234 const char data[] = {
235 char((m_value & 0xff000000) >> 24),
236 char((m_value & 0x00ff0000) >> 16),
237 char((m_value & 0x0000ff00) >> 8),
238 char((m_value & 0x000000ff)) };
239 return QByteArray(data,
sizeof(data));
242 static constexpr std::optional<Tag> fromValue(quint32 value)
noexcept
245 maybeTag.m_value = value;
246 return maybeTag.isValid() ? std::optional<Tag>(maybeTag) : std::nullopt;
248 Q_GUI_EXPORT
static std::optional<Tag> fromString(QAnyStringView view)
noexcept;
250#ifndef QT_NO_DATASTREAM
251 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, Tag);
252 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, Tag &);
255#ifndef QT_NO_DEBUG_STREAM
256 friend Q_GUI_EXPORT QDebug operator<<(QDebug debug, Tag tag);
259 friend constexpr size_t qHash(Tag key, size_t seed = 0)
noexcept
260 {
return qHash(key.value(), seed); }
263 friend constexpr bool comparesEqual(
const Tag &lhs,
const Tag &rhs)
noexcept
264 {
return lhs.m_value == rhs.m_value; }
265 friend constexpr Qt::strong_ordering compareThreeWay(
const Tag &lhs,
const Tag &rhs)
noexcept
266 {
return Qt::compareThreeWay(lhs.m_value, rhs.m_value); }
267 Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QFont::Tag)
272 void setFeature(Tag tag, quint32 value);
273 void unsetFeature(Tag tag);
274 quint32 featureValue(Tag tag)
const;
275 bool isFeatureSet(Tag tag)
const;
276 QList<Tag> featureTags()
const;
277 void clearFeatures();
279 void setVariableAxis(Tag tag,
float value);
280 void unsetVariableAxis(Tag tag);
281 bool isVariableAxisSet(Tag tag)
const;
282 float variableAxisValue(Tag tag)
const;
283 void clearVariableAxes();
284 QList<Tag> variableAxisTags()
const;
287 bool exactMatch()
const;
289 QFont &operator=(
const QFont &);
290 bool operator==(
const QFont &)
const;
291 bool operator!=(
const QFont &)
const;
292 bool operator<(
const QFont &)
const;
293 operator QVariant()
const;
294 bool isCopyOf(
const QFont &)
const;
295 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFont)
299 QString toString()
const;
300 bool fromString(
const QString &);
302 static QString substitute(
const QString &);
303 static QStringList substitutes(
const QString &);
304 static QStringList substitutions();
305 static void insertSubstitution(
const QString&,
const QString &);
306 static void insertSubstitutions(
const QString&,
const QStringList &);
307 static void removeSubstitutions(
const QString &);
308 static void initialize();
309 static void cleanup();
310 static void cacheStatistics();
312 QString defaultFamily()
const;
314 QFont resolve(
const QFont &)
const;
315 inline uint resolveMask()
const {
return resolve_mask; }
316 inline void setResolveMask(uint mask) { resolve_mask = mask; }
318#if QT_DEPRECATED_SINCE(6
, 0
)
319 QT_DEPRECATED_VERSION_X_6_0(
"Use setWeight() instead")
void setLegacyWeight(
int legacyWeight);
320 QT_DEPRECATED_VERSION_X_6_0(
"Use weight() instead")
int legacyWeight()
const;
324 explicit QFont(QFontPrivate *);
329 friend class QFontPrivate;
330 friend class QFontDialogPrivate;
331 friend class QFontMetrics;
332 friend class QFontMetricsF;
333 friend class QFontInfo;
334 friend class QPainter;
335 friend class QPainterPrivate;
336 friend class QApplication;
337 friend class QWidget;
338 friend class QWidgetPrivate;
339 friend class QTextLayout;
340 friend class QTextEngine;
341 friend class QStackTextEngine;
342 friend class QTextLine;
343 friend struct QScriptLine;
344 friend class QOpenGLContext;
345 friend class QWin32PaintEngine;
346 friend class QAlphaPaintEngine;
347 friend class QPainterPath;
348 friend class QTextItemInt;
349 friend class QPicturePaintEngine;
350 friend class QPainterReplayer;
351 friend class QPaintBufferEngine;
352 friend class QCommandLinkButtonPrivate;
353 friend class QFontEngine;
355#ifndef QT_NO_DATASTREAM
356 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QFont &);
357 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QFont &);
360#ifndef QT_NO_DEBUG_STREAM
361 friend Q_GUI_EXPORT QDebug operator<<(QDebug,
const QFont &);
364 QExplicitlySharedDataPointer<QFontPrivate> d;
370Q_GUI_EXPORT size_t qHash(
const QFont &font, size_t seed = 0)
noexcept;
372inline bool QFont::bold()
const
373{
return weight() > Medium; }
376inline void QFont::setBold(
bool enable)
377{ setWeight(enable ? Bold : Normal); }
379inline bool QFont::italic()
const
381 return (style() != StyleNormal);
384inline void QFont::setItalic(
bool b) {
385 setStyle(b ? StyleItalic : StyleNormal);
390
391
393#ifndef QT_NO_DATASTREAM
394Q_GUI_EXPORT
QDataStream &operator<<(QDataStream &,
const QFont &);
398#ifndef QT_NO_DEBUG_STREAM
399Q_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.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QStyleHints class contains platform specific hints and settings. \inmodule QtGui.
Combined button and popup list for selecting options.
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()
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)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
void applyTo(QWindow *window) const
static QWindowGeometrySpecification fromArgument(const QByteArray &a)