QStyleFactory Class

The QStyleFactory class creates QStyle objects. More...

Header: #include <QStyleFactory>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets

Static Public Members

QStyle *create(const QString &key)
QStringList keys()

Detailed Description

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).

Use the keys() function to retrieve the valid keys. The built-in styles, typically "windows" and "fusion", are always available. The platform styles are plugins and are available on their platform only: "windows11", which follows the Windows 11 Fluent design, and "windowsvista" on Windows, "macos" on macOS, and "android" on Android. The keys are case-insensitive.

See also QStyle.

Member Function Documentation

[static] QStyle *QStyleFactory::create(const QString &key)

Creates and returns a QStyle object that matches the given key, or returns nullptr if no matching style is found.

Both built-in styles and styles from style plugins are queried for a matching style.

Note: The keys are case-insensitive.

See also keys().

[static] QStringList QStyleFactory::keys()

Returns the list of valid keys, i.e. the keys this factory can create styles for.

See also create().