Qt 4.8
Static Public Functions | List of all members
QStyleFactory Class Reference

The QStyleFactory class creates QStyle objects. More...

#include <qstylefactory.h>

Static Public Functions

static QStylecreate (const QString &)
 
static QStringList keys ()
 Returns the list of valid keys, i.e. More...
 

Detailed Description

The QStyleFactory class creates QStyle objects.

The QStyle class is an abstract base class that encapsulates the look and feel of a GUI. QStyleFactory creates a QStyle object using the create() function and a key identifying the style. The styles are either built-in or dynamically loaded from a style plugin (see QStylePlugin).

The valid keys can be retrieved using the keys() function. Typically they include "windows", "motif", "cde", "plastique" and "cleanlooks". Depending on the platform, "windowsxp", "windowsvista" and "macintosh" may be available. Note that keys are case insensitive.

See also
QStyle

Definition at line 55 of file qstylefactory.h.

Functions

◆ create()

static QStyle* QStyleFactory::create ( const QString )
static

◆ keys()

QStringList QStyleFactory::keys ( )
static

Returns the list of valid keys, i.e.

the keys this factory can create styles for.

See also
create()

Definition at line 210 of file qstylefactory.cpp.

Referenced by QKde::kdeStyle(), QApplication::style(), and QGuiPlatformPlugin::styleName().

211 {
212 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
213  QStringList list = loader()->keys();
214 #else
215  QStringList list;
216 #endif
217 #ifndef QT_NO_STYLE_WINDOWS
218  if (!list.contains(QLatin1String("Windows")))
219  list << QLatin1String("Windows");
220 #endif
221 #ifndef QT_NO_STYLE_WINDOWSCE
222  if (!list.contains(QLatin1String("WindowsCE")))
223  list << QLatin1String("WindowsCE");
224 #endif
225 #ifndef QT_NO_STYLE_WINDOWSMOBILE
226  if (!list.contains(QLatin1String("WindowsMobile")))
227  list << QLatin1String("WindowsMobile");
228 #endif
229 #ifndef QT_NO_STYLE_WINDOWSXP
230  if (!list.contains(QLatin1String("WindowsXP")) &&
232  list << QLatin1String("WindowsXP");
233 #endif
234 #ifndef QT_NO_STYLE_WINDOWSVISTA
235  if (!list.contains(QLatin1String("WindowsVista")) &&
237  list << QLatin1String("WindowsVista");
238 #endif
239 #ifndef QT_NO_STYLE_MOTIF
240  if (!list.contains(QLatin1String("Motif")))
241  list << QLatin1String("Motif");
242 #endif
243 #ifndef QT_NO_STYLE_CDE
244  if (!list.contains(QLatin1String("CDE")))
245  list << QLatin1String("CDE");
246 #endif
247 #ifndef QT_NO_STYLE_S60
248  if (!list.contains(QLatin1String("S60")))
249  list << QLatin1String("S60");
250 #endif
251 #ifndef QT_NO_STYLE_PLASTIQUE
252  if (!list.contains(QLatin1String("Plastique")))
253  list << QLatin1String("Plastique");
254 #endif
255 #ifndef QT_NO_STYLE_GTK
256  if (!list.contains(QLatin1String("GTK+")))
257  list << QLatin1String("GTK+");
258 #endif
259 #ifndef QT_NO_STYLE_CLEANLOOKS
260  if (!list.contains(QLatin1String("Cleanlooks")))
261  list << QLatin1String("Cleanlooks");
262 #endif
263 #ifndef QT_NO_STYLE_MAC
264  QString mstyle = QLatin1String("Macintosh");
265 # ifdef Q_WS_MAC
266  mstyle += QLatin1String(" (aqua)");
267 # endif
268  if (!list.contains(mstyle))
269  list << mstyle;
270 #endif
271  return list;
272 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static const WinVersion WindowsVersion
the version of the Windows operating system on which the application is run (Windows only) ...
Definition: qglobal.h:1613
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
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

The documentation for this class was generated from the following files: