7#include <QtGui/qtguiglobal.h>
8#include <QtGui/qwindowdefs.h>
9#include <QtGui/qcolor.h>
10#include <QtGui/qbrush.h>
23 QPalette(
const QColor &button);
24 QPalette(Qt::GlobalColor button);
25 QPalette(
const QColor &button,
const QColor &window);
26 QPalette(
const QBrush &windowText,
const QBrush &button,
const QBrush &light,
27 const QBrush &dark,
const QBrush &mid,
const QBrush &text,
28 const QBrush &bright_text,
const QBrush &base,
const QBrush &window);
29 QPalette(
const QColor &windowText,
const QColor &window,
const QColor &light,
30 const QColor &dark,
const QColor &mid,
const QColor &text,
const QColor &base);
31 QPalette(
const QPalette &palette);
33 QPalette &operator=(
const QPalette &palette);
34 QPalette(QPalette &&other)
noexcept
35 : d(std::exchange(other.d,
nullptr)), currentGroup(other.currentGroup)
37 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPalette)
39 void swap(QPalette &other)
noexcept
41 std::swap(currentGroup, other.currentGroup);
42 qt_ptr_swap(d, other.d);
45 operator QVariant()
const;
50 enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active };
52 enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
53 Text, BrightText, ButtonText, Base, Window, Shadow,
54 Highlight, HighlightedText,
58 ToolTipBase, ToolTipText,
61 NColorRoles = Accent + 1,
65 inline ColorGroup currentColorGroup()
const {
return currentGroup; }
66 inline void setCurrentColorGroup(ColorGroup cg) { currentGroup = cg; }
68 inline const QColor &color(ColorGroup cg, ColorRole cr)
const
69 {
return brush(cg, cr).color(); }
70 const QBrush &brush(ColorGroup cg, ColorRole cr)
const;
71 inline void setColor(ColorGroup cg, ColorRole cr,
const QColor &color);
72 inline void setColor(ColorRole cr,
const QColor &color);
73 inline void setBrush(ColorRole cr,
const QBrush &brush);
74 bool isBrushSet(ColorGroup cg, ColorRole cr)
const;
75 void setBrush(ColorGroup cg, ColorRole cr,
const QBrush &brush);
76 void setColorGroup(ColorGroup cr,
const QBrush &windowText,
const QBrush &button,
77 const QBrush &light,
const QBrush &dark,
const QBrush &mid,
78 const QBrush &text,
const QBrush &bright_text,
const QBrush &base,
79 const QBrush &window);
80 bool isEqual(ColorGroup cr1, ColorGroup cr2)
const;
82 inline const QColor &color(ColorRole cr)
const {
return color(Current, cr); }
83 inline const QBrush &brush(ColorRole cr)
const {
return brush(Current, cr); }
84 inline const QBrush &windowText()
const {
return brush(WindowText); }
85 inline const QBrush &button()
const {
return brush(Button); }
86 inline const QBrush &light()
const {
return brush(Light); }
87 inline const QBrush &dark()
const {
return brush(Dark); }
88 inline const QBrush &mid()
const {
return brush(Mid); }
89 inline const QBrush &text()
const {
return brush(Text); }
90 inline const QBrush &base()
const {
return brush(Base); }
91 inline const QBrush &alternateBase()
const {
return brush(AlternateBase); }
92 inline const QBrush &toolTipBase()
const {
return brush(ToolTipBase); }
93 inline const QBrush &toolTipText()
const {
return brush(ToolTipText); }
94 inline const QBrush &window()
const {
return brush(Window); }
95 inline const QBrush &midlight()
const {
return brush(Midlight); }
96 inline const QBrush &brightText()
const {
return brush(BrightText); }
97 inline const QBrush &buttonText()
const {
return brush(ButtonText); }
98 inline const QBrush &shadow()
const {
return brush(Shadow); }
99 inline const QBrush &highlight()
const {
return brush(Highlight); }
100 inline const QBrush &highlightedText()
const {
return brush(HighlightedText); }
101 inline const QBrush &link()
const {
return brush(Link); }
102 inline const QBrush &linkVisited()
const {
return brush(LinkVisited); }
103 inline const QBrush &placeholderText()
const {
return brush(PlaceholderText); }
104 inline const QBrush &accent()
const {
return brush(Accent); }
106 bool operator==(
const QPalette &p)
const;
107 inline bool operator!=(
const QPalette &p)
const {
return !(operator==(p)); }
108 bool isCopyOf(
const QPalette &p)
const;
110 qint64 cacheKey()
const;
112 QPalette resolve(
const QPalette &other)
const;
114 using ResolveMask = quint64;
115 ResolveMask resolveMask()
const;
116 void setResolveMask(ResolveMask mask);
119 void setColorGroup(ColorGroup cr,
const QBrush &windowText,
const QBrush &button,
120 const QBrush &light,
const QBrush &dark,
const QBrush &mid,
121 const QBrush &text,
const QBrush &bright_text,
122 const QBrush &base,
const QBrush &alternate_base,
123 const QBrush &window,
const QBrush &midlight,
124 const QBrush &button_text,
const QBrush &shadow,
125 const QBrush &highlight,
const QBrush &highlighted_text,
126 const QBrush &link,
const QBrush &link_visited);
127 void setColorGroup(ColorGroup cr,
const QBrush &windowText,
const QBrush &button,
128 const QBrush &light,
const QBrush &dark,
const QBrush &mid,
129 const QBrush &text,
const QBrush &bright_text,
130 const QBrush &base,
const QBrush &alternate_base,
131 const QBrush &window,
const QBrush &midlight,
132 const QBrush &button_text,
const QBrush &shadow,
133 const QBrush &highlight,
const QBrush &highlighted_text,
134 const QBrush &link,
const QBrush &link_visited,
135 const QBrush &toolTipBase,
const QBrush &toolTipText);
140 ColorGroup currentGroup{Active};
142 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s,
const QPalette &p);
147inline void QPalette::setColor(ColorGroup acg, ColorRole acr,
148 const QColor &acolor)
149{ setBrush(acg, acr, QBrush(acolor)); }
150inline void QPalette::setColor(ColorRole acr,
const QColor &acolor)
151{ setColor(All, acr, acolor); }
152inline void QPalette::setBrush(ColorRole acr,
const QBrush &abrush)
153{ setBrush(All, acr, abrush); }
156
157
158#ifndef QT_NO_DATASTREAM
159Q_GUI_EXPORT
QDataStream &operator<<(QDataStream &ds,
const QPalette &p);
160Q_GUI_EXPORT
QDataStream &operator>>(QDataStream &ds, QPalette &p);
163#ifndef QT_NO_DEBUG_STREAM
164Q_GUI_EXPORT
QDebug operator<<(QDebug,
const QPalette &);
\inmodule QtCore\reentrant
The QIconEngine class provides an abstract base class for QIcon renderers.
QIconPrivate(QIconEngine *e)
static void clearIconCache()
static qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize)
The QImageReader class provides a format independent interface for reading images from files or other...
void setScaledClipRect(const QRect &rect)
Sets the scaled clip rect to rect.
QString errorString() const
Returns a human readable description of the last error that occurred.
bool decideFormatFromContent() const
Returns whether the image reader should decide which plugin to use only based on the contents of the ...
int imageCount() const
For image formats that support animation, this function returns the total number of images in the ani...
void setDevice(QIODevice *device)
Sets QImageReader's device to device.
bool autoTransform() const
bool autoDetectImageFormat() const
Returns true if image format autodetection is enabled on this image reader; otherwise returns false.
static QList< QByteArray > supportedMimeTypes()
Returns the list of MIME types supported by QImageReader.
int quality() const
Returns the quality setting of the image format.
QSize scaledSize() const
Returns the scaled size of the image.
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
void setFileName(const QString &fileName)
Sets the file name of QImageReader to fileName.
void setScaledSize(const QSize &size)
Sets the scaled size of the image to size.
QImageIOHandler::Transformations transformation() const
QIODevice * device() const
Returns the device currently assigned to QImageReader, or \nullptr if no device has been assigned.
QByteArray subType() const
QColor backgroundColor() const
Returns the background color that's used when reading an image.
static void setAllocationLimit(int mbLimit)
QImageReader(const QString &fileName, const QByteArray &format=QByteArray())
Constructs a QImageReader object with the file name fileName and the image format format.
QRect currentImageRect() const
For image formats that support animation, this function returns the rect for the current frame.
bool supportsAnimation() const
Returns true if the image format supports animation; otherwise, false is returned.
void setDecideFormatFromContent(bool ignored)
If ignored is set to true, then the image reader will ignore specified formats or file extensions and...
void setAutoTransform(bool enabled)
QString text(const QString &key) const
Returns the image text associated with key.
bool jumpToImage(int imageNumber)
For image formats that support animation, this function skips to the image whose sequence number is i...
QRect clipRect() const
Returns the clip rect (also known as the ROI, or Region Of Interest) of the image.
static QByteArray imageFormat(QIODevice *device)
If supported, this function returns the image format of the device device.
QImageReader()
Constructs an empty QImageReader object.
bool supportsOption(QImageIOHandler::ImageOption option) const
Returns true if the reader supports option; otherwise returns false.
static int allocationLimit()
QList< QByteArray > supportedSubTypes() const
QImageReader(QIODevice *device, const QByteArray &format=QByteArray())
Constructs a QImageReader object with the device device and the image format format.
static QList< QByteArray > imageFormatsForMimeType(const QByteArray &mimeType)
QByteArray format() const
Returns the format QImageReader uses for reading images.
bool canRead() const
Returns true if an image can be read for the device (i.e., the image format is supported,...
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
void setQuality(int quality)
Sets the quality setting of the image format to quality.
void setBackgroundColor(const QColor &color)
Sets the background color to color.
bool jumpToNextImage()
For image formats that support animation, this function steps over the current image,...
void setFormat(const QByteArray &format)
Sets the format QImageReader will use when reading images, to format.
QSize size() const
Returns the size of the image, without actually reading the image contents.
void setClipRect(const QRect &rect)
Sets the image clip rect (also known as the ROI, or Region Of Interest) to rect.
void setAutoDetectImageFormat(bool enabled)
If enabled is true, image format autodetection is enabled; otherwise, it is disabled.
int currentImageNumber() const
For image formats that support animation, this function returns the sequence number of the current fr...
ImageReaderError error() const
Returns the type of error that occurred last.
bool read(QImage *image)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QRect scaledClipRect() const
Returns the scaled clip rect of the image.
int nextImageDelay() const
For image formats that support animation, this function returns the number of milliseconds to wait un...
QStringList textKeys() const
Returns the text keys for this image.
int loopCount() const
For image formats that support animation, this function returns the number of times the animation sho...
QImage::Format imageFormat() const
Returns the format of the image, without actually reading the image contents.
QImage read()
Reads an image from the device.
static QByteArray imageFormat(const QString &fileName)
If supported, this function returns the image format of the file fileName.
The QPalette class contains color groups for each widget state.
QDataStream & operator>>(QDataStream &s, QKeyCombination &combination)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static void qt_cleanup_icon_cache()
static constexpr auto themeIconMapping
static int origIcoDepth(const QImage &image)
static qint64 area(const QSize &s)
static int nextSerialNumCounter()
static QIconEngine * iconEngineFromSuffix(const QString &fileName, const QString &suffix)
QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio, qreal *sourceDevicePixelRatio)
static int findBySize(const QList< QImage > &images, const QSize &size)
static QPixmapIconEngineEntry * bestSizeScaleMatch(const QSize &size, qreal scale, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb)
static constexpr QLatin1StringView themeIconName(QIcon::ThemeIcon icon)
Q_DECLARE_TYPEINFO(QPixmapIconEngineEntry, Q_RELOCATABLE_TYPE)
#define QIconEngineFactoryInterface_iid
Q_GLOBAL_STATIC_WITH_ARGS(PermissionStatusHash, g_permissionStatusHash,({ { qMetaTypeId< QCameraPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QMicrophonePermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QBluetoothPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QContactsPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QCalendarPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QLocationPermission >(), Qt::PermissionStatus::Undetermined } }))
QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m, QIcon::State s)
QPixmapIconEngineEntry()=default
QPixmapIconEngineEntry(const QString &file, const QSize &sz, QIcon::Mode m, QIcon::State s)