Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qicon_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QICON_P_H
5#define QICON_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtCore/qsize.h>
20#include <QtCore/qlist.h>
21#include <QtGui/qpixmap.h>
22#include <QtGui/qicon.h>
23#include <QtGui/qiconengine.h>
24
25#ifndef QT_NO_ICON
27
29{
30public:
31 explicit QIconPrivate(QIconEngine *e);
32
34 delete engine;
35 }
36
37 qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize);
38
40
44 bool is_mask;
45
46 static void clearIconCache();
47};
48
49
51{
54 :pixmap(pm), size(pm.size()), scale(pm.devicePixelRatio()), mode(m), state(s){}
56 :fileName(file), size(sz), scale(1), mode(m), state(s){}
64 bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); }
65};
67
69 : fileName(file), size(image.size()), scale(image.devicePixelRatio()), mode(m), state(s)
70{
72}
73
74class Q_GUI_EXPORT QPixmapIconEngine : public QIconEngine {
75public:
82 QPixmapIconEngineEntry *bestMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
86 void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override;
87
88
89 QString key() const override;
90 QIconEngine *clone() const override;
91 bool read(QDataStream &in) override;
92 bool write(QDataStream &out) const override;
93
94private:
97
98 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QIcon &icon);
99 friend class QIconThemeEngine;
100};
101
103#endif //QT_NO_ICON
104#endif // QICON_P_H
\inmodule QtCore
Definition qatomic.h:112
\inmodule QtCore\reentrant
Definition qdatastream.h:30
The QIconEngine class provides an abstract base class for QIcon renderers.
Definition qiconengine.h:15
virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
virtual QIconEngine * clone() const =0
Reimplement this method to return a clone of this icon engine.
virtual bool read(QDataStream &in)
Reads icon engine contents from the QDataStream in.
virtual void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
Called by QIcon::addFile().
virtual QList< QSize > availableSizes(QIcon::Mode mode=QIcon::Normal, QIcon::State state=QIcon::Off)
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the actual size of the icon the engine provides for the requested size, mode and state.
virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
Called by QIcon::addPixmap().
virtual QString key() const
\variable QIconEngine::ScaledPixmapArgument::size
virtual bool write(QDataStream &out) const
Writes the contents of this engine to the QDataStream out.
QAtomicInt ref
Definition qicon_p.h:41
QIconEngine * engine
Definition qicon_p.h:39
int serialNum
Definition qicon_p.h:42
bool is_mask
Definition qicon_p.h:44
~QIconPrivate()
Definition qicon_p.h:33
int detach_no
Definition qicon_p.h:43
static void clearIconCache()
Definition qicon.cpp:101
qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize)
Definition qicon.cpp:117
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition qicon.h:22
@ Normal
Definition qicon.h:22
State
This enum describes the state for which a pixmap is intended to be used.
Definition qicon.h:23
@ Off
Definition qicon.h:23
\inmodule QtGui
Definition qimage.h:37
Definition qlist.h:74
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags=Qt::AutoColor)
Replaces this pixmap's data with the given image using the specified flags to control the conversion.
Definition qpixmap.cpp:980
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition qpixmap.cpp:460
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QPainter paint
double e
rect
[4]
else opt state
[0]
Combined button and popup list for selecting options.
Definition image.cpp:4
GLenum mode
const GLfloat * m
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint in
GLdouble s
[6]
Definition qopenglext.h:235
GLenum GLenum GLenum GLenum GLenum scale
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:145
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
double qreal
Definition qtypes.h:92
QFile file
[0]
QTextStream out(stdout)
[7]
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
widget render & pixmap
QPainter painter(this)
[7]
QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m=QIcon::Normal, QIcon::State s=QIcon::Off)
Definition qicon_p.h:53
bool isNull() const
Definition qicon_p.h:64
QIcon::State state
Definition qicon_p.h:63
QIcon::Mode mode
Definition qicon_p.h:62
QPixmapIconEngineEntry(const QString &file, const QSize &sz=QSize(), QIcon::Mode m=QIcon::Normal, QIcon::State s=QIcon::Off)
Definition qicon_p.h:55