Open 3D Engine AzQtComponents API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Classes | Static Public Member Functions | Friends | List of all members
AzQtComponents::PushButton Class Reference

Class to handle styling and painting of QPushButton controls. More...

#include <PushButton.h>


struct  Border
struct  ColorSet
 Structure to specify multiple gradients for different widget states. More...
struct  Config
 Style configuration for the PushButton class. More...
struct  DropdownButton
struct  Frame
struct  Gradient
struct  IconButton
struct  SmallIcon

Static Public Member Functions

static void applyPrimaryStyle (QPushButton *button)
 Applies the Primary styling to a QPushButton.
static void applySmallIconStyle (QToolButton *button)
 Applies the Primary styling to a QToolButton.
static Config loadConfig (QSettings &settings)
static Config defaultConfig ()
 Gets the default PushButton style configuration.


class Style

Detailed Description

Class to handle styling and painting of QPushButton controls.

Special class to handle styling and painting of PushButtons.

We have to use default QPushButton's throughout the engine, because QMessageBox's and other built-in Qt things don't provide an easy hook to override the type used. So, this class, full of static member functions, provides a place to collect all of the logic related to painting/styling QPushButton's

The built-in Qt version of QPushButton painting is not very good. The edges of the frame aren't anti-aliased and don't look quite right.

Unfortunately, Qt (as of 5.6) doesn't provide any hooks to query stylesheet values once loaded. To avoid writing and maintaining our own css parsing and rule engine, we just override the painting directly, and allow settings to be customized via an ini file.

Some of the styling of QPushButton and QToolButton is done via CSS, in PushButton.qss Everything else that can be configured is in PushButtonConfig.ini

There are currently three built-in styles: Our default QPushButton style Our Primary QPushButton style, specified via pushButton->setDefault(true); Small Icon QToolButton style, specified via PushButton::applySmallIconStyle(toolButton);

Member Function Documentation

◆ loadConfig()

static Config AzQtComponents::PushButton::loadConfig ( QSettings &  settings)

Sets the PushButton style configuration.

settingsThe settings object to load the configuration from.
The new configuration of the PushButton.

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