Kirigami2

icon.cpp
1 /*
2  * SPDX-FileCopyrightText: 2011 Marco Martin <[email protected]>
3  * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <[email protected]>
4  *
5  * SPDX-License-Identifier: LGPL-2.0-or-later
6  */
7 
8 #include "icon.h"
9 #include "libkirigami/platformtheme.h"
10 #include "scenegraph/managedtexturenode.h"
11 
12 #include "loggingcategory.h"
13 #include <QBitmap>
14 #include <QDebug>
15 #include <QGuiApplication>
16 #include <QIcon>
17 #include <QPainter>
18 #include <QQuickImageProvider>
19 #include <QQuickWindow>
20 #include <QSGSimpleTextureNode>
21 #include <QSGTexture>
22 #include <QScreen>
23 #include <QtQml>
24 
25 Q_GLOBAL_STATIC(ImageTexturesCache, s_iconImageCache)
26 
27 Icon::Icon(QQuickItem *parent)
28  : QQuickItem(parent)
29  , m_changed(false)
30  , m_active(false)
31  , m_selected(false)
32  , m_isMask(false)
33 {
34  setFlag(ItemHasContents, true);
35  // Using 32 because Icon used to redefine implicitWidth and implicitHeight and hardcode them to 32
36  setImplicitSize(32, 32);
37  // FIXME: not necessary anymore
39  connect(this, &QQuickItem::enabledChanged, this, &QQuickItem::polish);
40  connect(this, &QQuickItem::smoothChanged, this, &QQuickItem::polish);
41 }
42 
43 Icon::~Icon()
44 {
45 }
46 
47 void Icon::setSource(const QVariant &icon)
48 {
49  if (m_source == icon) {
50  return;
51  }
52  m_source = icon;
53  m_monochromeHeuristics.clear();
54 
55  if (!m_theme) {
56  m_theme = static_cast<Kirigami::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::PlatformTheme>(this, true));
57  Q_ASSERT(m_theme);
58 
59  connect(m_theme, &Kirigami::PlatformTheme::colorsChanged, this, &QQuickItem::polish);
60  }
61 
62  if (icon.type() == QVariant::String) {
63  const QString iconSource = icon.toString();
64  m_isMaskHeuristic = (iconSource.endsWith(QLatin1String("-symbolic")) //
65  || iconSource.endsWith(QLatin1String("-symbolic-rtl")) //
66  || iconSource.endsWith(QLatin1String("-symbolic-ltr")));
67  Q_EMIT isMaskChanged();
68  }
69 
70  if (m_networkReply) {
71  // if there was a network query going on, interrupt it
72  m_networkReply->close();
73  }
74  m_loadedImage = QImage();
75  setStatus(Loading);
76 
77  polish();
78  Q_EMIT sourceChanged();
79  Q_EMIT validChanged();
80 }
81 
82 QVariant Icon::source() const
83 {
84  return m_source;
85 }
86 
87 void Icon::setActive(const bool active)
88 {
89  if (active == m_active) {
90  return;
91  }
92  m_active = active;
93  polish();
94  Q_EMIT activeChanged();
95 }
96 
97 bool Icon::active() const
98 {
99  return m_active;
100 }
101 
102 bool Icon::valid() const
103 {
104  // TODO: should this be return m_status == Ready?
105  // Consider an empty URL invalid, even though isNull() will say false
106  if (m_source.canConvert<QUrl>() && m_source.toUrl().isEmpty()) {
107  return false;
108  }
109 
110  return !m_source.isNull();
111 }
112 
113 void Icon::setSelected(const bool selected)
114 {
115  if (selected == m_selected) {
116  return;
117  }
118  m_selected = selected;
119  polish();
120  Q_EMIT selectedChanged();
121 }
122 
123 bool Icon::selected() const
124 {
125  return m_selected;
126 }
127 
128 void Icon::setIsMask(bool mask)
129 {
130  if (m_isMask == mask) {
131  return;
132  }
133 
134  m_isMask = mask;
135  m_isMaskHeuristic = mask;
136  polish();
137  Q_EMIT isMaskChanged();
138 }
139 
140 bool Icon::isMask() const
141 {
142  return m_isMask || m_isMaskHeuristic;
143 }
144 
145 void Icon::setColor(const QColor &color)
146 {
147  if (m_color == color) {
148  return;
149  }
150 
151  m_color = color;
152  polish();
153  Q_EMIT colorChanged();
154 }
155 
156 QColor Icon::color() const
157 {
158  return m_color;
159 }
160 
161 QSGNode *Icon::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData * /*data*/)
162 {
163  if (m_source.isNull() || qFuzzyIsNull(width()) || qFuzzyIsNull(height())) {
164  delete node;
165  return Q_NULLPTR;
166  }
167 
168  if (m_changed || node == nullptr) {
169  const QSize itemSize(width(), height());
170  QRect nodeRect(QPoint(0, 0), itemSize);
171 
172  ManagedTextureNode *mNode = dynamic_cast<ManagedTextureNode *>(node);
173  if (!mNode) {
174  delete node;
175  mNode = new ManagedTextureNode;
176  }
177  if (itemSize.width() != 0 && itemSize.height() != 0) {
178  mNode->setTexture(s_iconImageCache->loadTexture(window(), m_icon, QQuickWindow::TextureCanUseAtlas));
179  if (m_icon.size() != itemSize) {
180  // At this point, the image will already be scaled, but we need to output it in
181  // the correct aspect ratio, painted centered in the viewport. So:
182  QRect destination(QPoint(0, 0), m_icon.size().scaled(itemSize, Qt::KeepAspectRatio));
183  destination.moveCenter(nodeRect.center());
184  nodeRect = destination;
185  }
186  }
187  mNode->setRect(nodeRect);
188  node = mNode;
189  if (smooth()) {
191  }
192  m_changed = false;
193  }
194 
195  return node;
196 }
197 
198 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
199 void Icon::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
200 {
201  QQuickItem::geometryChanged(newGeometry, oldGeometry);
202 #else
203 void Icon::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
204 {
205  QQuickItem::geometryChange(newGeometry, oldGeometry);
206 #endif
207  if (newGeometry.size() != oldGeometry.size()) {
208  polish();
209  }
210 }
211 
212 void Icon::handleRedirect(QNetworkReply *reply)
213 {
214  QNetworkAccessManager *qnam = reply->manager();
215  if (reply->error() != QNetworkReply::NoError) {
216  return;
217  }
218  const QUrl possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
219  if (!possibleRedirectUrl.isEmpty()) {
220  const QUrl redirectUrl = reply->url().resolved(possibleRedirectUrl);
221  if (redirectUrl == reply->url()) {
222  // no infinite redirections thank you very much
223  reply->deleteLater();
224  return;
225  }
226  reply->deleteLater();
227  QNetworkRequest request(possibleRedirectUrl);
229  m_networkReply = qnam->get(request);
230  connect(m_networkReply.data(), &QNetworkReply::finished, this, [this]() {
231  handleFinished(m_networkReply);
232  });
233  }
234 }
235 
236 void Icon::handleFinished(QNetworkReply *reply)
237 {
238  if (!reply) {
239  return;
240  }
241 
242  reply->deleteLater();
244  handleRedirect(reply);
245  return;
246  }
247 
248  m_loadedImage = QImage();
249 
250  const QString filename = reply->url().fileName();
251  if (!m_loadedImage.load(reply, filename.mid(filename.indexOf(QLatin1Char('.'))).toLatin1().constData())) {
252  qCWarning(KirigamiLog) << "received broken image" << reply->url();
253 
254  // broken image from data, inform the user of this with some useful broken-image thing...
255  const QIcon icon = QIcon::fromTheme(m_fallback);
256  m_loadedImage = icon.pixmap(window(), icon.actualSize(size().toSize()), iconMode(), QIcon::On).toImage();
257  }
258 
259  polish();
260 }
261 
262 void Icon::updatePolish()
263 {
265 
266  if (m_source.isNull()) {
267  setStatus(Ready);
268  updatePaintedGeometry();
269  update();
270  return;
271  }
272 
273  const QSize itemSize(width(), height());
274  if (itemSize.width() != 0 && itemSize.height() != 0) {
276  ? 1
277  : (window() ? window()->effectiveDevicePixelRatio() : qGuiApp->devicePixelRatio());
278  const QSize size = itemSize * multiplier;
279 
280  switch (m_source.type()) {
281  case QVariant::Pixmap:
282  m_icon = m_source.value<QPixmap>().toImage();
283  break;
284  case QVariant::Image:
285  m_icon = m_source.value<QImage>();
286  break;
287  case QVariant::Bitmap:
288  m_icon = m_source.value<QBitmap>().toImage();
289  break;
290  case QVariant::Icon: {
291  const QIcon icon = m_source.value<QIcon>();
292  m_icon = icon.pixmap(window(), icon.actualSize(itemSize), iconMode(), QIcon::On).toImage();
293  break;
294  }
295  case QVariant::Url:
296  case QVariant::String:
297  m_icon = findIcon(size);
298  break;
299  case QVariant::Brush:
300  // todo: fill here too?
301  case QVariant::Color:
302  m_icon = QImage(size, QImage::Format_Alpha8);
303  m_icon.fill(m_source.value<QColor>());
304  break;
305  default:
306  break;
307  }
308 
309  if (m_icon.isNull()) {
310  m_icon = QImage(size, QImage::Format_Alpha8);
311  m_icon.fill(Qt::transparent);
312  }
313 
314  const QColor tintColor = //
315  !m_color.isValid() || m_color == Qt::transparent //
316  ? (m_selected ? m_theme->highlightedTextColor() : m_theme->textColor())
317  : m_color;
318 
319  // TODO: initialize m_isMask with icon.isMask()
320  if (tintColor.alpha() > 0 && (isMask() || guessMonochrome(m_icon))) {
321  QPainter p(&m_icon);
322  p.setCompositionMode(QPainter::CompositionMode_SourceIn);
323  p.fillRect(m_icon.rect(), tintColor);
324  p.end();
325  }
326  }
327  m_changed = true;
328  updatePaintedGeometry();
329  update();
330 }
331 
332 QImage Icon::findIcon(const QSize &size)
333 {
334  QImage img;
335  QString iconSource = m_source.toString();
336 
337  if (iconSource.startsWith(QLatin1String("image://"))) {
339  ? (window() ? window()->effectiveDevicePixelRatio() : qGuiApp->devicePixelRatio())
340  : 1;
341  QUrl iconUrl(iconSource);
342  QString iconProviderId = iconUrl.host();
343  // QUrl path has the "/" prefix while iconId does not
344  QString iconId = iconUrl.path().remove(0, 1);
345 
347  QQuickImageProvider *imageProvider = dynamic_cast<QQuickImageProvider *>(qmlEngine(this)->imageProvider(iconProviderId));
348  if (!imageProvider) {
349  return img;
350  }
351  switch (imageProvider->imageType()) {
353  img = imageProvider->requestImage(iconId, &actualSize, size * multiplier);
354  if (!img.isNull()) {
355  setStatus(Ready);
356  }
357  break;
359  img = imageProvider->requestPixmap(iconId, &actualSize, size * multiplier).toImage();
360  if (!img.isNull()) {
361  setStatus(Ready);
362  }
363  break;
365  if (!m_loadedImage.isNull()) {
366  setStatus(Ready);
367  return m_loadedImage.scaled(size, Qt::KeepAspectRatio, smooth() ? Qt::SmoothTransformation : Qt::FastTransformation);
368  }
369  QQuickAsyncImageProvider *provider = dynamic_cast<QQuickAsyncImageProvider *>(imageProvider);
370  auto response = provider->requestImageResponse(iconId, size * multiplier);
371  connect(response, &QQuickImageResponse::finished, this, [iconId, response, this]() {
372  if (response->errorString().isEmpty()) {
373  QQuickTextureFactory *textureFactory = response->textureFactory();
374  if (textureFactory) {
375  m_loadedImage = textureFactory->image();
376  delete textureFactory;
377  }
378  if (m_loadedImage.isNull()) {
379  // broken image from data, inform the user of this with some useful broken-image thing...
380  const QIcon icon = QIcon::fromTheme(m_fallback);
381  m_loadedImage = icon.pixmap(window(), icon.actualSize(QSize(width(), height())), iconMode(), QIcon::On).toImage();
382  setStatus(Error);
383  } else {
384  setStatus(Ready);
385  }
386  polish();
387  }
388  response->deleteLater();
389  });
390  // Temporary icon while we wait for the real image to load...
391  const QIcon icon = QIcon::fromTheme(m_placeholder);
392  img = icon.pixmap(window(), icon.actualSize(size), iconMode(), QIcon::On).toImage();
393  break;
394  }
396  QQuickTextureFactory *textureFactory = imageProvider->requestTexture(iconId, &actualSize, size * multiplier);
397  if (textureFactory) {
398  img = textureFactory->image();
399  }
400  if (img.isNull()) {
401  // broken image from data, or the texture factory wasn't healthy, inform the user of this with some useful broken-image thing...
402  const QIcon icon = QIcon::fromTheme(m_fallback);
403  img = icon.pixmap(window(), icon.actualSize(QSize(width(), height())), iconMode(), QIcon::On).toImage();
404  setStatus(Error);
405  } else {
406  setStatus(Ready);
407  }
408  break;
409  }
411  // will have to investigate this more
412  setStatus(Error);
413  break;
414  }
415  } else if (iconSource.startsWith(QLatin1String("http://")) || iconSource.startsWith(QLatin1String("https://"))) {
416  if (!m_loadedImage.isNull()) {
417  setStatus(Ready);
418  return m_loadedImage.scaled(size, Qt::KeepAspectRatio, smooth() ? Qt::SmoothTransformation : Qt::FastTransformation);
419  }
420  const auto url = m_source.toUrl();
421  QQmlEngine *engine = qmlEngine(this);
422  QNetworkAccessManager *qnam;
423  if (engine && (qnam = engine->networkAccessManager()) && (!m_networkReply || m_networkReply->url() != url)) {
424  QNetworkRequest request(url);
426  m_networkReply = qnam->get(request);
427  connect(m_networkReply.data(), &QNetworkReply::finished, this, [this]() {
428  handleFinished(m_networkReply);
429  });
430  }
431  // Temporary icon while we wait for the real image to load...
432  const QIcon icon = QIcon::fromTheme(m_placeholder);
433  img = icon.pixmap(window(), icon.actualSize(size), iconMode(), QIcon::On).toImage();
434  } else {
435  if (iconSource.startsWith(QLatin1String("qrc:/"))) {
436  iconSource = iconSource.mid(3);
437  } else if (iconSource.startsWith(QLatin1String("file:/"))) {
438  iconSource = QUrl(iconSource).path();
439  }
440 
441  QIcon icon;
442  const bool isPath = iconSource.contains(QLatin1String("/"));
443  if (isPath) {
444  icon = QIcon(iconSource);
445  } else {
446  if (icon.isNull()) {
447  icon = m_theme->iconFromTheme(iconSource, m_color);
448  }
449  }
450  if (!icon.isNull()) {
451  img = icon.pixmap(window(), icon.actualSize(window(), size), iconMode(), QIcon::On).toImage();
452 
453  setStatus(Ready);
454  /*const QColor tintColor = !m_color.isValid() || m_color == Qt::transparent ? (m_selected ? m_theme->highlightedTextColor() : m_theme->textColor())
455  : m_color;
456 
457  if (m_isMask || icon.isMask() || iconSource.endsWith(QLatin1String("-symbolic")) || iconSource.endsWith(QLatin1String("-symbolic-rtl")) ||
458  iconSource.endsWith(QLatin1String("-symbolic-ltr")) || guessMonochrome(img)) { //
459  QPainter p(&img);
460  p.setCompositionMode(QPainter::CompositionMode_SourceIn);
461  p.fillRect(img.rect(), tintColor);
462  p.end();
463  }*/
464  }
465  }
466 
467  if (!iconSource.isEmpty() && img.isNull()) {
468  setStatus(Error);
469  const QIcon icon = QIcon::fromTheme(m_fallback);
470  img = icon.pixmap(window(), icon.actualSize(size), iconMode(), QIcon::On).toImage();
471  }
472  return img;
473 }
474 
475 QIcon::Mode Icon::iconMode() const
476 {
477  if (!isEnabled()) {
478  return QIcon::Disabled;
479  } else if (m_selected) {
480  return QIcon::Selected;
481  } else if (m_active) {
482  return QIcon::Active;
483  }
484  return QIcon::Normal;
485 }
486 
487 bool Icon::guessMonochrome(const QImage &img)
488 {
489  // don't try for too big images
490  if (img.width() >= 256 || m_theme->supportsIconColoring()) {
491  return false;
492  }
493  // round size to a standard size. hardcode as we can't use KIconLoader
494  int stdSize;
495  if (img.width() <= 16) {
496  stdSize = 16;
497  } else if (img.width() <= 22) {
498  stdSize = 22;
499  } else if (img.width() <= 24) {
500  stdSize = 24;
501  } else if (img.width() <= 32) {
502  stdSize = 32;
503  } else if (img.width() <= 48) {
504  stdSize = 48;
505  } else if (img.width() <= 64) {
506  stdSize = 64;
507  } else {
508  stdSize = 128;
509  }
510 
511  auto findIt = m_monochromeHeuristics.constFind(stdSize);
512  if (findIt != m_monochromeHeuristics.constEnd()) {
513  return findIt.value();
514  }
515 
516  QHash<int, int> dist;
517  int transparentPixels = 0;
518  int saturatedPixels = 0;
519  for (int x = 0; x < img.width(); x++) {
520  for (int y = 0; y < img.height(); y++) {
521  QColor color = QColor::fromRgba(qUnpremultiply(img.pixel(x, y)));
522  if (color.alpha() < 100) {
523  ++transparentPixels;
524  continue;
525  } else if (color.saturation() > 84) {
526  ++saturatedPixels;
527  }
528  dist[qGray(color.rgb())]++;
529  }
530  }
531 
532  QMultiMap<int, int> reverseDist;
533  auto it = dist.constBegin();
534  qreal entropy = 0;
535  while (it != dist.constEnd()) {
536  reverseDist.insert(it.value(), it.key());
537  qreal probability = qreal(it.value()) / qreal(img.size().width() * img.size().height() - transparentPixels);
538  entropy -= probability * log(probability) / log(255);
539  ++it;
540  }
541 
542  // Arbitrarily low values of entropy and colored pixels
543  m_monochromeHeuristics[stdSize] = saturatedPixels <= (img.size().width() * img.size().height() - transparentPixels) * 0.3 && entropy <= 0.3;
544  return m_monochromeHeuristics[stdSize];
545 }
546 
547 QString Icon::fallback() const
548 {
549  return m_fallback;
550 }
551 
552 void Icon::setFallback(const QString &fallback)
553 {
554  if (m_fallback != fallback) {
555  m_fallback = fallback;
556  Q_EMIT fallbackChanged(fallback);
557  }
558 }
559 
561 {
562  return m_placeholder;
563 }
564 
565 void Icon::setPlaceholder(const QString &placeholder)
566 {
567  if (m_placeholder != placeholder) {
568  m_placeholder = placeholder;
569  Q_EMIT placeholderChanged(placeholder);
570  }
571 }
572 
573 void Icon::setStatus(Status status)
574 {
575  if (status == m_status) {
576  return;
577  }
578 
579  m_status = status;
580  Q_EMIT statusChanged();
581 }
582 
584 {
585  return m_status;
586 }
587 
588 qreal Icon::paintedWidth() const
589 {
590  return m_paintedWidth;
591 }
592 
593 qreal Icon::paintedHeight() const
594 {
595  return m_paintedHeight;
596 }
597 
598 void Icon::updatePaintedGeometry()
599 {
600  qreal newWidth = 0.0;
601  qreal newHeight = 0.0;
602  if (!m_icon.width() || !m_icon.height()) {
603  newWidth = newHeight = 0.0;
604  } else {
605  const qreal w = widthValid() ? width() : m_icon.size().width();
606  const qreal widthScale = w / m_icon.size().width();
607  const qreal h = heightValid() ? height() : m_icon.size().height();
608  const qreal heightScale = h / m_icon.size().height();
609  if (widthScale <= heightScale) {
610  newWidth = w;
611  newHeight = widthScale * m_icon.size().height();
612  } else if (heightScale < widthScale) {
613  newWidth = heightScale * m_icon.size().width();
614  newHeight = h;
615  }
616  }
617  if (newWidth != m_paintedWidth || newHeight != m_paintedHeight) {
618  m_paintedWidth = newWidth;
619  m_paintedHeight = newHeight;
620  Q_EMIT paintedAreaChanged();
621  }
622 }
623 
624 void Icon::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
625 {
627  polish();
628  }
629  QQuickItem::itemChange(change, value);
630 }
631 
632 #include "moc_icon.cpp"
bool isNull() const const
Status
Definition: icon.h:156
void paletteChanged(const QPalette &palette)
int devicePixelRatio() const const
virtual void updatePolish()
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
void enabledChanged()
int height() const const
QUrl toUrl() const const
QNetworkReply::NetworkError error() const const
AA_UseHighDpiPixmaps
QRgb rgb() const const
bool valid
Whether this icon's source is valid and it is being used.
Definition: icon.h:99
QIcon fromTheme(const QString &name)
void setRect(const QRectF &r)
int width() const const
QColor fromRgba(QRgb rgba)
void polish()
virtual QQmlImageProviderBase::ImageType imageType() const const override
QNetworkReply * get(const QNetworkRequest &request)
QString placeholder
The name of an icon from the icon theme to show while the icon set in source is being loaded.
Definition: icon.h:79
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
QNetworkAccessManager * manager() const const
QUrl url() const const
int saturation() const const
bool isMask
Whether this icon will be treated as a mask.
Definition: icon.h:122
virtual QQuickTextureFactory * requestTexture(const QString &id, QSize *size, const QSize &requestedSize)
void deleteLater()
virtual QQuickImageResponse * requestImageResponse(const QString &id, const QSize &requestedSize)=0
bool selected
Whether this icon will use the QIcon::Selected mode when drawing the icon, resulting in a graphical e...
Definition: icon.h:113
KeepAspectRatio
QRgb pixel(int x, int y) const const
QColor color
The color to use when drawing this icon when isMask is enabled.
Definition: icon.h:130
bool isEmpty() const const
int height() const const
QVariant::Type type() const const
QHash::const_iterator constBegin() const const
virtual void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
QHash::const_iterator constEnd() const const
virtual QImage image() const const
bool isNull() const const
bool isEmpty() const const
QString fileName(QUrl::ComponentFormattingOptions options) const const
bool isNull() const const
QCoreApplication * instance()
Q_SCRIPTABLE CaptureState status()
int alpha() const const
bool active
Whether this icon will use the QIcon::Active mode when drawing the icon, resulting in a graphical eff...
Definition: icon.h:94
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
void clear()
bool testAttribute(Qt::ApplicationAttribute attribute)
QSize size() const const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
typename QMap< Key, T >::iterator insert(const Key &key, const T &value)
QUrl resolved(const QUrl &relative) const const
QImage toImage() const const
QString & remove(int position, int n)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
QVariant attribute(QNetworkRequest::Attribute code) const const
QAction * actualSize(const QObject *recvr, const char *slot, QObject *parent)
QString fallback
The name of a fallback icon to load from the icon theme when the source cannot be found.
Definition: icon.h:66
QString path(QUrl::ComponentFormattingOptions options) const const
qreal paintedWidth
The width of the painted area measured in pixels.
Definition: icon.h:146
QNetworkAccessManager * networkAccessManager() const const
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) const const
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
void update(Part *part, const QByteArray &data, qint64 dataSize)
bool isValid() const const
Icon::Status status
Whether the icon is correctly loaded, is asynchronously loading or there was an error.
Definition: icon.h:138
qreal paintedHeight
The height of the painted area measured in pixels.
Definition: icon.h:154
QSizeF size() const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
KJOBWIDGETS_EXPORT QWidget * window(KJob *job)
CompositionMode_SourceIn
SmoothTransformation
void smoothChanged(bool)
QString mid(int position, int n) const const
QVariant source
The source of this icon.
Definition: icon.h:56
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) const const
void setFiltering(QSGTexture::Filtering filtering)
transparent
virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize)
QString toString() const const
int width() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.