Qt 4.8
Functions
qiconloader.cpp File Reference
#include <private/qiconloader_p.h>
#include <private/qapplication_p.h>
#include <private/qicon_p.h>
#include <private/qguiplatformplugin_p.h>
#include <QtGui/QIconEnginePlugin>
#include <QtGui/QPixmapCache>
#include <QtGui/QIconEngine>
#include <QtGui/QStyleOption>
#include <QtCore/QList>
#include <QtCore/QHash>
#include <QtCore/QDir>
#include <QtCore/QSettings>
#include <QtGui/QPainter>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_x11_p.h>
#include <private/qstylehelper_p.h>

Go to the source code of this file.

Functions

static bool directoryMatchesSize (const QIconDirInfo &dir, int iconsize)
 
static int directorySizeDistance (const QIconDirInfo &dir, int iconsize)
 
static QString fallbackTheme ()
 

Function Documentation

◆ directoryMatchesSize()

static bool directoryMatchesSize ( const QIconDirInfo dir,
int  iconsize 
)
static

Definition at line 383 of file qiconloader.cpp.

Referenced by QIconLoaderEngine::entryForSize().

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 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ directorySizeDistance()

static int directorySizeDistance ( const QIconDirInfo dir,
int  iconsize 
)
static

Definition at line 405 of file qiconloader.cpp.

Referenced by QIconLoaderEngine::entryForSize().

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 }
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define INT_MAX

◆ fallbackTheme()

static QString fallbackTheme ( )
static

Definition at line 73 of file qiconloader.cpp.

Referenced by QIconLoader::ensureInitialized(), QIconLoader::findIconHelper(), QIconTheme::QIconTheme(), and QIconLoader::updateSystemTheme().

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 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define X11
Definition: qt_x11_p.h:724
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