Qt 4.8
qiconloader.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef QT_NO_ICON
42 #include <private/qiconloader_p.h>
43 
44 #include <private/qapplication_p.h>
45 #include <private/qicon_p.h>
46 #include <private/qguiplatformplugin_p.h>
47 
48 #include <QtGui/QIconEnginePlugin>
49 #include <QtGui/QPixmapCache>
50 #include <QtGui/QIconEngine>
51 #include <QtGui/QStyleOption>
52 #include <QtCore/QList>
53 #include <QtCore/QHash>
54 #include <QtCore/QDir>
55 #include <QtCore/QSettings>
56 #include <QtGui/QPainter>
57 
58 #ifdef Q_WS_MAC
59 #include <private/qt_cocoa_helpers_mac_p.h>
60 #endif
61 
62 #ifdef Q_WS_X11
63 #include <private/qt_x11_p.h>
64 #endif
65 
66 #include <private/qstylehelper_p.h>
67 
69 
70 Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
71 
72 /* Theme to use in last resort, if the theme does not have the icon, neither the parents */
74 {
75 #ifdef Q_WS_X11
76  if (X11->desktopEnvironment == DE_GNOME) {
77  return QLatin1String("gnome");
78  } else if (X11->desktopEnvironment == DE_KDE) {
79  return X11->desktopVersion >= 4
80  ? QString::fromLatin1("oxygen")
81  : QString::fromLatin1("crystalsvg");
82  } else {
83  return QLatin1String("hicolor");
84  }
85 #endif
86  return QString();
87 }
88 
90  m_themeKey(1), m_supportsSvg(false), m_initialized(false)
91 {
92 }
93 
94 // We lazily initialize the loader to make static icons
95 // work. Though we do not officially support this.
97 {
98  if (!m_initialized) {
99  m_initialized = true;
100 
101  Q_ASSERT(qApp);
102 
104  if (m_systemTheme.isEmpty())
106 #ifndef QT_NO_LIBRARY
108  QLatin1String("/iconengines"),
110  if (iconFactoryLoader.keys().contains(QLatin1String("svg")))
111  m_supportsSvg = true;
112 #endif //QT_NO_LIBRARY
113  }
114 }
115 
117 {
118  return iconLoaderInstance();
119 }
120 
121 // Queries the system theme and invalidates existing
122 // icons if the theme has changed.
124 {
125  // Only change if this is not explicitly set by the user
126  if (m_userTheme.isEmpty()) {
128  if (theme.isEmpty())
129  theme = fallbackTheme();
130  if (theme != m_systemTheme) {
132  invalidateKey();
133  }
134  }
135 }
136 
138 {
140  invalidateKey();
141 }
142 
144 {
145  m_iconDirs = searchPaths;
146  themeList.clear();
147  invalidateKey();
148 }
149 
151 {
152  if (m_iconDirs.isEmpty()) {
154  // Always add resource directory as search path
155  m_iconDirs.append(QLatin1String(":/icons"));
156  }
157  return m_iconDirs;
158 }
159 
161  : m_valid(false)
162 {
163  QFile themeIndex;
164 
167  for ( int i = 0 ; i < iconDirs.size() ; ++i) {
168  QDir iconDir(iconDirs[i]);
169  QString themeDir = iconDir.path() + QLatin1Char('/') + themeName;
170  themeIndex.setFileName(themeDir + QLatin1String("/index.theme"));
171  if (themeIndex.exists()) {
172  m_contentDir = themeDir;
173  m_valid = true;
174  break;
175  }
176  }
177 #ifndef QT_NO_SETTINGS
178  if (themeIndex.exists()) {
179  const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
180  QStringListIterator keyIterator(indexReader.allKeys());
181  while (keyIterator.hasNext()) {
182 
183  const QString key = keyIterator.next();
184  if (key.endsWith(QLatin1String("/Size"))) {
185  // Note the QSettings ini-format does not accept
186  // slashes in key names, hence we have to cheat
187  if (int size = indexReader.value(key).toInt()) {
188  QString directoryKey = key.left(key.size() - 5);
189  QIconDirInfo dirInfo(directoryKey);
190  dirInfo.size = size;
191  QString type = indexReader.value(directoryKey +
192  QLatin1String("/Type")
193  ).toString();
194 
195  if (type == QLatin1String("Fixed"))
196  dirInfo.type = QIconDirInfo::Fixed;
197  else if (type == QLatin1String("Scalable"))
198  dirInfo.type = QIconDirInfo::Scalable;
199  else
200  dirInfo.type = QIconDirInfo::Threshold;
201 
202  dirInfo.threshold = indexReader.value(directoryKey +
203  QLatin1String("/Threshold"),
204  2).toInt();
205 
206  dirInfo.minSize = indexReader.value(directoryKey +
207  QLatin1String("/MinSize"),
208  size).toInt();
209 
210  dirInfo.maxSize = indexReader.value(directoryKey +
211  QLatin1String("/MaxSize"),
212  size).toInt();
213  m_keyList.append(dirInfo);
214  }
215  }
216  }
217 
218  // Parent themes provide fallbacks for missing icons
219  m_parents = indexReader.value(
220  QLatin1String("Icon Theme/Inherits")).toStringList();
221 
222  // Ensure a default platform fallback for all themes
223  if (m_parents.isEmpty())
225 
226  // Ensure that all themes fall back to hicolor
227  if (!m_parents.contains(QLatin1String("hicolor")))
228  m_parents.append(QLatin1String("hicolor"));
229  }
230 #endif //QT_NO_SETTINGS
231 }
232 
234  const QString &iconName,
235  QStringList &visited) const
236 {
238  Q_ASSERT(!themeName.isEmpty());
239 
240  QPixmap pixmap;
241 
242  // Used to protect against potential recursions
243  visited << themeName;
244 
245  QIconTheme theme = themeList.value(themeName);
246  if (!theme.isValid()) {
247  theme = QIconTheme(themeName);
248  if (!theme.isValid())
249  theme = QIconTheme(fallbackTheme());
250 
251  themeList.insert(themeName, theme);
252  }
253 
254  QString contentDir = theme.contentDir() + QLatin1Char('/');
255  QList<QIconDirInfo> subDirs = theme.keyList();
256 
257  const QString svgext(QLatin1String(".svg"));
258  const QString pngext(QLatin1String(".png"));
259 
260  // Add all relevant files
261  for (int i = 0; i < subDirs.size() ; ++i) {
262  const QIconDirInfo &dirInfo = subDirs.at(i);
263  QString subdir = dirInfo.path;
264  QDir currentDir(contentDir + subdir);
265  if (currentDir.exists(iconName + pngext)) {
266  PixmapEntry *iconEntry = new PixmapEntry;
267  iconEntry->dir = dirInfo;
268  iconEntry->filename = currentDir.filePath(iconName + pngext);
269  // Notice we ensure that pixmap entries always come before
270  // scalable to preserve search order afterwards
271  entries.prepend(iconEntry);
272  } else if (m_supportsSvg &&
273  currentDir.exists(iconName + svgext)) {
274  ScalableEntry *iconEntry = new ScalableEntry;
275  iconEntry->dir = dirInfo;
276  iconEntry->filename = currentDir.filePath(iconName + svgext);
277  entries.append(iconEntry);
278  }
279  }
280 
281  if (entries.isEmpty()) {
282  const QStringList parents = theme.parents();
283  // Search recursively through inherited themes
284  for (int i = 0 ; i < parents.size() ; ++i) {
285 
286  const QString parentTheme = parents.at(i).trimmed();
287 
288  if (!visited.contains(parentTheme)) // guard against recursion
289  entries = findIconHelper(parentTheme, iconName, visited);
290 
291  if (!entries.isEmpty()) // success
292  break;
293  }
294  }
295  return entries;
296 }
297 
299 {
300  if (!themeName().isEmpty()) {
301  QStringList visited;
302  return findIconHelper(themeName(), name, visited);
303  }
304 
305  return QThemeIconEntries();
306 }
307 
308 
309 // -------- Icon Loader Engine -------- //
310 
311 
313  : m_iconName(iconName), m_key(0)
314 {
315 }
316 
318 {
319  while (!m_entries.isEmpty())
320  delete m_entries.takeLast();
321  Q_ASSERT(m_entries.size() == 0);
322 }
323 
325  : QIconEngineV2(other),
326  m_iconName(other.m_iconName),
327  m_key(0)
328 {
329 }
330 
332 {
333  return new QIconLoaderEngine(*this);
334 }
335 
337  in >> m_iconName;
338  return true;
339 }
340 
342 {
343  out << m_iconName;
344  return true;
345 }
346 
348 {
349  return !(m_entries.isEmpty());
350 }
351 
352 // Lazily load the icon
354 {
355 
356  iconLoaderInstance()->ensureInitialized();
357 
358  if (!(iconLoaderInstance()->themeKey() == m_key)) {
359 
360  while (!m_entries.isEmpty())
361  delete m_entries.takeLast();
362 
363  Q_ASSERT(m_entries.size() == 0);
364  m_entries = iconLoaderInstance()->loadIcon(m_iconName);
365  m_key = iconLoaderInstance()->themeKey();
366  }
367 }
368 
369 void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
370  QIcon::Mode mode, QIcon::State state)
371 {
372  QSize pixmapSize = rect.size();
373 #if defined(Q_WS_MAC)
374  pixmapSize *= qt_mac_get_scalefactor();
375 #endif
376  painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
377 }
378 
379 /*
380  * This algorithm is defined by the freedesktop spec:
381  * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
382  */
383 static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize)
384 {
385  if (dir.type == QIconDirInfo::Fixed) {
386  return dir.size == iconsize;
387 
388  } else if (dir.type == QIconDirInfo::Scalable) {
389  return dir.size <= dir.maxSize &&
390  iconsize >= dir.minSize;
391 
392  } else if (dir.type == QIconDirInfo::Threshold) {
393  return iconsize >= dir.size - dir.threshold &&
394  iconsize <= dir.size + dir.threshold;
395  }
396 
397  Q_ASSERT(1); // Not a valid value
398  return false;
399 }
400 
401 /*
402  * This algorithm is defined by the freedesktop spec:
403  * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
404  */
405 static int directorySizeDistance(const QIconDirInfo &dir, int iconsize)
406 {
407  if (dir.type == QIconDirInfo::Fixed) {
408  return qAbs(dir.size - iconsize);
409 
410  } else if (dir.type == QIconDirInfo::Scalable) {
411  if (iconsize < dir.minSize)
412  return dir.minSize - iconsize;
413  else if (iconsize > dir.maxSize)
414  return iconsize - dir.maxSize;
415  else
416  return 0;
417 
418  } else if (dir.type == QIconDirInfo::Threshold) {
419  if (iconsize < dir.size - dir.threshold)
420  return dir.minSize - iconsize;
421  else if (iconsize > dir.size + dir.threshold)
422  return iconsize - dir.maxSize;
423  else return 0;
424  }
425 
426  Q_ASSERT(1); // Not a valid value
427  return INT_MAX;
428 }
429 
431 {
432  int iconsize = qMin(size.width(), size.height());
433 
434  // Note that m_entries are sorted so that png-files
435  // come first
436 
437  // Search for exact matches first
438  for (int i = 0; i < m_entries.count(); ++i) {
439  QIconLoaderEngineEntry *entry = m_entries.at(i);
440  if (directoryMatchesSize(entry->dir, iconsize)) {
441  return entry;
442  }
443  }
444 
445  // Find the minimum distance icon
446  int minimalSize = INT_MAX;
448  for (int i = 0; i < m_entries.count(); ++i) {
449  QIconLoaderEngineEntry *entry = m_entries.at(i);
450  int distance = directorySizeDistance(entry->dir, iconsize);
451  if (distance < minimalSize) {
452  minimalSize = distance;
453  closestMatch = entry;
454  }
455  }
456  return closestMatch;
457 }
458 
459 /*
460  * Returns the actual icon size. For scalable svg's this is equivalent
461  * to the requested size. Otherwise the closest match is returned but
462  * we can never return a bigger size than the requested size.
463  *
464  */
466  QIcon::State state)
467 {
468  ensureLoaded();
469 
470  QIconLoaderEngineEntry *entry = entryForSize(size);
471  if (entry) {
472  const QIconDirInfo &dir = entry->dir;
473  if (dir.type == QIconDirInfo::Scalable)
474  return size;
475  else {
476  int result = qMin<int>(dir.size, qMin(size.width(), size.height()));
477  return QSize(result, result);
478  }
479  }
480  return QIconEngineV2::actualSize(size, mode, state);
481 }
482 
484 {
485  Q_UNUSED(state);
486 
487  // Ensure that basePixmap is lazily initialized before generating the
488  // key, otherwise the cache key is not unique
489  if (basePixmap.isNull())
490  basePixmap.load(filename);
491 
492  int actualSize = qMin(size.width(), size.height());
493 
494  QString key = QLatin1Literal("$qt_theme_")
495  % HexString<qint64>(basePixmap.cacheKey())
496  % HexString<int>(mode)
497  % HexString<qint64>(qApp->palette().cacheKey())
498  % HexString<int>(actualSize);
499 
500  QPixmap cachedPixmap;
501  if (QPixmapCache::find(key, &cachedPixmap)) {
502  return cachedPixmap;
503  } else {
504  QStyleOption opt(0);
505  opt.palette = qApp->palette();
506  cachedPixmap = qApp->style()->generatedIconPixmap(mode, basePixmap, &opt);
507  QPixmapCache::insert(key, cachedPixmap);
508  }
509  return cachedPixmap;
510 }
511 
513 {
514  if (svgIcon.isNull())
515  svgIcon = QIcon(filename);
516 
517  // Simply reuse svg icon engine
518  return svgIcon.pixmap(size, mode, state);
519 }
520 
522  QIcon::State state)
523 {
524  ensureLoaded();
525 
526  QIconLoaderEngineEntry *entry = entryForSize(size);
527  if (entry)
528  return entry->pixmap(size, mode, state);
529 
530  return QPixmap();
531 }
532 
534 {
535  return QLatin1String("QIconLoaderEngine");
536 }
537 
539 {
540  ensureLoaded();
541 
542  switch (id) {
544  {
546  = *reinterpret_cast<QIconEngineV2::AvailableSizesArgument*>(data);
547  const QList<QIconDirInfo> directoryKey = iconLoaderInstance()->theme().keyList();
548  arg.sizes.clear();
549 
550  // Gets all sizes from the DirectoryInfo entries
551  for (int i = 0 ; i < m_entries.size() ; ++i) {
552  int size = m_entries.at(i)->dir.size;
553  arg.sizes.append(QSize(size, size));
554  }
555  }
556  break;
558  {
559  QString &name = *reinterpret_cast<QString*>(data);
560  name = m_iconName;
561  }
562  break;
563  default:
564  QIconEngineV2::virtual_hook(id, data);
565  }
566 }
567 
569 
570 #endif //QT_NO_ICON
The QDir class provides access to directory structures and their contents.
Definition: qdir.h:58
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
Uses the given painter to paint the icon with the required mode and state into the rectangle rect...
QString fileName() const
Returns the name set by setFileName() or to the QFile constructors.
Definition: qfile.cpp:470
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
void invalidateKey()
int type
Definition: qmetatype.cpp:239
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void clear()
Removes all items from the hash.
Definition: qhash.h:574
The QSettings class provides persistent platform-independent application settings.
Definition: qsettings.h:73
virtual QStringList iconThemeSearchPaths()
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the actual size of the icon the engine provides for the requested size, mode and state...
Definition: qiconengine.cpp:87
CGFloat qt_mac_get_scalefactor()
void setThemeName(const QString &themeName)
State
This enum describes the state for which a pixmap is intended to be used.
Definition: qicon.h:64
void setThemeSearchPath(const QStringList &searchPaths)
QIconLoaderEngine(const QString &iconName=QString())
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QGuiPlatformPlugin * qt_guiPlatformPlugin()
Return (an construct if necesseray) the Gui Platform plugin.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isValid()
QIconEngineV2 * clone() const
Returns a clone of this icon engine.
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool read(QDataStream &in)
Reads icon engine contents from the QDataStream in.
QList< QIconDirInfo > keyList()
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
static QStringList themeSearchPaths()
Returns the search paths for icon themes.
Definition: qicon.cpp:963
bool exists() const
Returns true if the directory exists; otherwise returns false.
Definition: qdir.cpp:1560
static QPixmap * find(const QString &key)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
Definition: qfile.cpp:626
QStringList m_parents
int width() const
Returns the width.
Definition: qsize.h:126
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QStringList keys() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
This struct represents arguments to virtual_hook() function when id parameter is QIconEngineV2::Avail...
Definition: qiconengine.h:85
static bool isEmpty(const char *str)
QList< QIconDirInfo > m_keyList
virtual QString systemIconThemeName()
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
QStringList m_iconDirs
const char * name
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
Definition: qglobal.h:1968
void prepend(const T &t)
Inserts value at the beginning of the list.
Definition: qlist.h:541
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition: qicon.h:63
virtual void virtual_hook(int id, void *data)
Additional method to allow extending QIconEngineV2 without adding new virtual methods (and without br...
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize)
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QList< QSize > sizes
image sizes that are available with specified mode and
Definition: qiconengine.h:89
QStringList parents()
static QString fallbackTheme()
Definition: qiconloader.cpp:73
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
static int distance(QWidget *source, QWidget *target, QAccessible::RelationFlag relation)
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
void clear()
Removes all items from the list.
Definition: qlist.h:764
bool m_supportsSvg
The QIconEngineV2 class provides an abstract base class for QIcon renderers.
Definition: qiconengine.h:73
bool write(QDataStream &out) const
Writes the contents of this engine to the QDataStream out.
QStringList themeSearchPaths() const
QIconTheme theme()
static QIconLoader * instance()
void virtual_hook(int id, void *data)
Additional method to allow extending QIconEngineV2 without adding new virtual methods (and without br...
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
QThemeIconEntries m_entries
static const MacSpecialKey entries[NumEntries]
bool m_initialized
QString key() const
Returns a key that identifies this icon engine.
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
QList< QIconLoaderEngineEntry * > QThemeIconEntries
QString themeName() const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void updateSystemTheme()
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
int key
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
int height() const
Returns the height.
Definition: qsize.h:129
static int directorySizeDistance(const QIconDirInfo &dir, int iconsize)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool hasIcon() const
static int closestMatch(QRgb pixel, const QVector< QRgb > &clut)
Definition: qimage.cpp:4015
QListIterator< QString > QStringListIterator
Definition: qstringlist.h:61
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the icon as a pixmap with the required size, mode, and state.
QString m_systemTheme
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QString contentDir()
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
T takeLast()
Removes the last item in the list and returns it.
Definition: qlist.h:492
QThemeIconEntries loadIcon(const QString &iconName) const
QHash< QString, QIconTheme > themeList
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
QString path() const
Returns the path.
Definition: qdir.cpp:605
QIconEngineFactoryInterfaceV2_iid
Definition: qicon.cpp:451
QString filePath(const QString &fileName) const
Returns the path name of a file in the directory.
Definition: qdir.cpp:678
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
void ensureInitialized()
Definition: qiconloader.cpp:96
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
QIconLoaderEngineEntry * entryForSize(const QSize &size)
QString m_userTheme
QString m_contentDir
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the actual size of the icon the engine provides for the requested size, mode and state...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
#define INT_MAX
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)=0
void setFileName(const QString &name)
Sets the name of the file.
Definition: qfile.cpp:494
QString path
Definition: qiconloader_p.h:78
QThemeIconEntries findIconHelper(const QString &themeName, const QString &iconName, QStringList &visited) const
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60