23 enum Mode { Normal, Disabled, Active, Selected };
25 enum State { On, Off };
28 enum class ThemeIcon {
62 FormatTextDirectionLtr,
63 FormatTextDirectionRtl,
67 FormatTextStrikethrough,
116 AudioInputMicrophone,
162 MediaPlaylistShuffle,
167 SoftwareUpdateAvailable,
168 SoftwareUpdateUrgent,
176 WeatherFewCloudsNight,
187 QIcon(
const QPixmap &pixmap);
188 QIcon(
const QIcon &other);
189 QIcon(QIcon &&other)
noexcept
190 : d(std::exchange(other.d,
nullptr))
192 explicit QIcon(
const QString &fileName);
193 explicit QIcon(QIconEngine *engine);
195 QIcon &operator=(
const QIcon &other);
196 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon)
197 inline void swap(QIcon &other)
noexcept
198 { qt_ptr_swap(d, other.d); }
199 bool operator==(
const QIcon &)
const =
delete;
200 bool operator!=(
const QIcon &)
const =
delete;
202 operator QVariant()
const;
204 QPixmap pixmap(
const QSize &size, Mode mode = Normal, State state = Off)
const;
205 inline QPixmap pixmap(
int w,
int h, Mode mode = Normal, State state = Off)
const
206 {
return pixmap(QSize(w, h), mode, state); }
207 inline QPixmap pixmap(
int extent, Mode mode = Normal, State state = Off)
const
208 {
return pixmap(QSize(extent, extent), mode, state); }
209 QPixmap pixmap(
const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off)
const;
210#if QT_DEPRECATED_SINCE(6
, 0
)
211 QT_DEPRECATED_VERSION_X_6_0(
"Use pixmap(size, devicePixelRatio) instead")
212 QPixmap pixmap(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
215 QSize actualSize(
const QSize &size, Mode mode = Normal, State state = Off)
const;
216#if QT_DEPRECATED_SINCE(6
, 0
)
217 QT_DEPRECATED_VERSION_X_6_0(
"Use actualSize(size) instead")
218 QSize actualSize(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
221 QString name()
const;
223 void paint(QPainter *painter,
const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off)
const;
224 inline void paint(QPainter *painter,
int x,
int y,
int w,
int h, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off)
const
225 { paint(painter, QRect(x, y, w, h), alignment, mode, state); }
228 bool isDetached()
const;
231 qint64 cacheKey()
const;
233 void addPixmap(
const QPixmap &pixmap, Mode mode = Normal, State state = Off);
234 void addFile(
const QString &fileName,
const QSize &size = QSize(), Mode mode = Normal, State state = Off);
236 QList<QSize> availableSizes(Mode mode = Normal, State state = Off)
const;
238 void setIsMask(
bool isMask);
241 static QIcon fromTheme(
const QString &name);
242 static QIcon fromTheme(
const QString &name,
const QIcon &fallback);
243 static bool hasThemeIcon(
const QString &name);
245 static QIcon fromTheme(ThemeIcon icon);
246 static QIcon fromTheme(ThemeIcon icon,
const QIcon &fallback);
247 static bool hasThemeIcon(ThemeIcon icon);
249 static QStringList themeSearchPaths();
250 static void setThemeSearchPaths(
const QStringList &searchpath);
252 static QStringList fallbackSearchPaths();
253 static void setFallbackSearchPaths(
const QStringList &paths);
255 static QString themeName();
256 static void setThemeName(
const QString &path);
258 static QString fallbackThemeName();
259 static void setFallbackThemeName(
const QString &name);
263#if !defined(QT_NO_DATASTREAM)
264 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QIcon &);
265 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
269 typedef QIconPrivate * DataPtr;
270 inline DataPtr &data_ptr() {
return d; }