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

KDE's Doxygen guidelines are available online.