QStyleFactory Class
The QStyleFactory class creates QStyle objects. More…
| Header | #include <QStyleFactory> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
List of all members, including inherited members
Static Public Members
| QStringList | keys() |
| QStyle * | create(const QString &key) |
Detailed Description
A style draws the widgets of an application. The factory makes a style from its name, which is how a program lets its user or a setting choose one:
if (QStyle *style = QStyleFactory::create(settings.value("style").toString()))
QApplication::setStyle(style);
keys() lists the names that create() knows.
See also QStyle and QApplication::setStyle().
Differences from Qt
Nt has one style, Fusion, and no style plugins, so keys() has that one name. The names Windows and WindowsVista, which programs written for Qt ask for, are not known: create() returns nullptr for them, as Qt does on a platform that lacks them.
Member Function Documentation
QStyle * QStyleFactory::create(const QString &key)
Returns a new style of the kind called key, or nullptr if there is no such style. The case of key does not matter. The caller owns the style; QApplication::setStyle() takes it over.
See also keys().
QStringList QStyleFactory::keys()
Returns the names of the styles that create() can make.
See also create().