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

KDE's Doxygen guidelines are available online.