23 Q_CLASSINFO(
"RegisterEnumClassesUnscoped",
"false")
25 enum Mode { Normal, Disabled, Active, Selected };
27 enum State { On, Off };
30 enum class ThemeIcon {
64 FormatTextDirectionLtr,
65 FormatTextDirectionRtl,
69 FormatTextStrikethrough,
118 AudioInputMicrophone,
164 MediaPlaylistShuffle,
169 SoftwareUpdateAvailable,
170 SoftwareUpdateUrgent,
178 WeatherFewCloudsNight,
189 QIcon(
const QPixmap &pixmap);
190 QIcon(
const QIcon &other);
191 QIcon(QIcon &&other)
noexcept
192 : d(std::exchange(other.d,
nullptr))
194 explicit QIcon(
const QString &fileName);
195 explicit QIcon(QIconEngine *engine);
197 QIcon &operator=(
const QIcon &other);
198 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon)
199 inline void swap(QIcon &other)
noexcept
200 { qt_ptr_swap(d, other.d); }
201 bool operator==(
const QIcon &)
const =
delete;
202 bool operator!=(
const QIcon &)
const =
delete;
204 operator QVariant()
const;
206 QPixmap pixmap(
const QSize &size, Mode mode = Normal, State state = Off)
const;
207 inline QPixmap pixmap(
int w,
int h, Mode mode = Normal, State state = Off)
const
208 {
return pixmap(QSize(w, h), mode, state); }
209 inline QPixmap pixmap(
int extent, Mode mode = Normal, State state = Off)
const
210 {
return pixmap(QSize(extent, extent), mode, state); }
211 QPixmap pixmap(
const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off)
const;
212#if QT_DEPRECATED_SINCE(6
, 0
)
213 QT_DEPRECATED_VERSION_X_6_0(
"Use pixmap(size, devicePixelRatio) instead")
214 QPixmap pixmap(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
217 QSize actualSize(
const QSize &size, Mode mode = Normal, State state = Off)
const;
218#if QT_DEPRECATED_SINCE(6
, 0
)
219 QT_DEPRECATED_VERSION_X_6_0(
"Use actualSize(size) instead")
220 QSize actualSize(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
223 QString name()
const;
225 void paint(QPainter *painter,
const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off)
const;
226 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
227 { paint(painter, QRect(x, y, w, h), alignment, mode, state); }
230 bool isDetached()
const;
233 qint64 cacheKey()
const;
235 void addPixmap(
const QPixmap &pixmap, Mode mode = Normal, State state = Off);
236 void addFile(
const QString &fileName,
const QSize &size = QSize(), Mode mode = Normal, State state = Off);
238 QList<QSize> availableSizes(Mode mode = Normal, State state = Off)
const;
240 void setIsMask(
bool isMask);
243 static QIcon fromTheme(
const QString &name);
244 static QIcon fromTheme(
const QString &name,
const QIcon &fallback);
245 static bool hasThemeIcon(
const QString &name);
247 static QIcon fromTheme(ThemeIcon icon);
248 static QIcon fromTheme(ThemeIcon icon,
const QIcon &fallback);
249 static bool hasThemeIcon(ThemeIcon icon);
251 static QStringList themeSearchPaths();
252 static void setThemeSearchPaths(
const QStringList &searchpath);
254 static QStringList fallbackSearchPaths();
255 static void setFallbackSearchPaths(
const QStringList &paths);
257 static QString themeName();
258 static void setThemeName(
const QString &path);
260 static QString fallbackThemeName();
261 static void setFallbackThemeName(
const QString &name);
265#if !defined(QT_NO_DATASTREAM)
266 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QIcon &);
267 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
270 friend class QIconPrivate;
273 typedef QIconPrivate * DataPtr;
274 inline DataPtr &data_ptr() {
return d; }