22 Q_CLASSINFO(
"RegisterEnumClassesUnscoped",
"false")
24 enum Mode { Normal, Disabled, Active, Selected };
26 enum State { On, Off };
29 enum class ThemeIcon {
63 FormatTextDirectionLtr,
64 FormatTextDirectionRtl,
68 FormatTextStrikethrough,
117 AudioInputMicrophone,
163 MediaPlaylistShuffle,
168 SoftwareUpdateAvailable,
169 SoftwareUpdateUrgent,
177 WeatherFewCloudsNight,
188 QIcon(
const QPixmap &pixmap);
189 QIcon(
const QIcon &other);
190 QIcon(QIcon &&other)
noexcept
191 : d(std::exchange(other.d,
nullptr))
193 explicit QIcon(
const QString &fileName);
194 explicit QIcon(QIconEngine *engine);
196 QIcon &operator=(
const QIcon &other);
197 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon)
198 inline void swap(QIcon &other)
noexcept
199 { qt_ptr_swap(d, other.d); }
200 bool operator==(
const QIcon &)
const =
delete;
201 bool operator!=(
const QIcon &)
const =
delete;
203 operator QVariant()
const;
205 QPixmap pixmap(
const QSize &size, Mode mode = Normal, State state = Off)
const;
206 inline QPixmap pixmap(
int w,
int h, Mode mode = Normal, State state = Off)
const
207 {
return pixmap(QSize(w, h), mode, state); }
208 inline QPixmap pixmap(
int extent, Mode mode = Normal, State state = Off)
const
209 {
return pixmap(QSize(extent, extent), mode, state); }
210 QPixmap pixmap(
const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off)
const;
211#if QT_DEPRECATED_SINCE(6
, 0
)
212 QT_DEPRECATED_VERSION_X_6_0(
"Use pixmap(size, devicePixelRatio) instead")
213 QPixmap pixmap(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
216 QSize actualSize(
const QSize &size, Mode mode = Normal, State state = Off)
const;
217#if QT_DEPRECATED_SINCE(6
, 0
)
218 QT_DEPRECATED_VERSION_X_6_0(
"Use actualSize(size) instead")
219 QSize actualSize(QWindow *window,
const QSize &size, Mode mode = Normal, State state = Off)
const;
222 QString name()
const;
224 void paint(QPainter *painter,
const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off)
const;
225 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
226 { paint(painter, QRect(x, y, w, h), alignment, mode, state); }
229 bool isDetached()
const;
232 qint64 cacheKey()
const;
234 void addPixmap(
const QPixmap &pixmap, Mode mode = Normal, State state = Off);
235 void addFile(
const QString &fileName,
const QSize &size = QSize(), Mode mode = Normal, State state = Off);
237 QList<QSize> availableSizes(Mode mode = Normal, State state = Off)
const;
239 void setIsMask(
bool isMask);
242 static QIcon fromTheme(
const QString &name);
243 static QIcon fromTheme(
const QString &name,
const QIcon &fallback);
244 static bool hasThemeIcon(
const QString &name);
246 static QIcon fromTheme(ThemeIcon icon);
247 static QIcon fromTheme(ThemeIcon icon,
const QIcon &fallback);
248 static bool hasThemeIcon(ThemeIcon icon);
250 static QStringList themeSearchPaths();
251 static void setThemeSearchPaths(
const QStringList &searchpath);
253 static QStringList fallbackSearchPaths();
254 static void setFallbackSearchPaths(
const QStringList &paths);
256 static QString themeName();
257 static void setThemeName(
const QString &path);
259 static QString fallbackThemeName();
260 static void setFallbackThemeName(
const QString &name);
264#if !defined(QT_NO_DATASTREAM)
265 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QIcon &);
266 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
269 friend class QIconPrivate;
272 typedef QIconPrivate * DataPtr;
273 inline DataPtr &data_ptr() {
return d; }