Open 3D Engine AzQtComponents API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzQtComponents::ColorPicker Class Reference

Allows the user to select a color via a dialog window. More...

#include <ColorPicker.h>

Inherits AzQtComponents::LogicalTabOrderingWidget< StyledDialog >.

Classes

struct  ColorGridConfig
 Style configuration for the color grid. More...
 
struct  Config
 Style configuration for the ColorPicker class. More...
 
struct  DialogButtonsConfig
 Style configuration for the dialog buttons. More...
 

Public Types

enum class  Configuration { RGBA , RGB , HueSaturation }
 Available color configurations. More...
 

Public Slots

void setSelectedColor (const AZ::Color &color)
 
void setCurrentColor (const AZ::Color &color)
 

Signals

void selectedColorChanged (const AZ::Color &color)
 
void currentColorChanged (const AZ::Color &color)
 

Public Member Functions

 ColorPicker (Configuration configuration, const QString &context=QString(), QWidget *parent=nullptr)
 
AZ::Color selectedColor () const
 Returns the previously selected color in the dialog. It is updated to the current color when the OK button is pressed.
 
AZ::Color currentColor () const
 Returns the current color in the dialog. Updates in real time when the user changes settings in the dialog.
 
void setComment (QString comment)
 Sets a comment string that will be included in the UI as a custom message that may provide some context for the user.
 
void setAlternateColorspaceEnabled (bool enabled)
 Sets up some read-only output for displaying color values in an alternate color space.
 
void setAlternateColorspaceName (const QString &name)
 
void setAlternateColorspaceValue (const AZ::Color &color)
 
void importPalettesFromFolder (const QString &path)
 Populates the palette list with the palettes stored at the folder path provided.
 
- Public Member Functions inherited from AzQtComponents::LogicalTabOrderingWidget< StyledDialog >
 LogicalTabOrderingWidget (QWidget *parent=nullptr)
 
bool focusNextPrevChild (bool next) override
 
void markToRecalculateTabKeyOrdering ()
 
- Public Member Functions inherited from AzQtComponents::StyledDialog
 StyledDialog (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
 
void enableSaveRestoreGeometry (const QString &key)
 
bool restoreGeometryFromSettings ()
 

Static Public Member Functions

static Config loadConfig (QSettings &settings)
 
static Config defaultConfig ()
 Gets the default ColorPicker style configuration.
 
static AZ::Color getColor (Configuration configuration, const AZ::Color &initial, const QString &title, const QString &context=QString(), const QStringList &palettePaths=QStringList(), QWidget *parent=nullptr)
 

Protected Member Functions

bool eventFilter (QObject *o, QEvent *e) override
 
void hideEvent (QHideEvent *event) override
 
void done (int result) override
 
void contextMenuEvent (QContextMenuEvent *e) override
 

Properties

AZ::Color selectedColor
 The previously selected color in the dialog. It is updated to the current color when the OK button is pressed.
 
AZ::Color currentColor
 The current color in the dialog. Updates in real time when the user changes settings in the dialog.
 

Friends

class Style
 
class CurrentColorChangedCommand
 
class PaletteAddedCommand
 
class PaletteRemovedCommand
 

Detailed Description

Allows the user to select a color via a dialog window.

Member Enumeration Documentation

◆ Configuration

Available color configurations.

Enumerator
HueSaturation 

Simplified mode for picking lighting related values.

Constructor & Destructor Documentation

◆ ColorPicker()

AzQtComponents::ColorPicker::ColorPicker ( Configuration  configuration,
const QString &  context = QString(),
QWidget *  parent = nullptr 
)
explicit

Constructor for the ColorPicker class.

Parameters
configurationThe color Configuration for the ColorPicker.
contextContext name, used to store settings and window sizing. Leave empty to use the default context.
parentPointer to the parent widget.

Member Function Documentation

◆ currentColorChanged

void AzQtComponents::ColorPicker::currentColorChanged ( const AZ::Color &  color)
signal

Triggered when the current color is changed.

Parameters
colorThe new current color.

◆ getColor()

static AZ::Color AzQtComponents::ColorPicker::getColor ( Configuration  configuration,
const AZ::Color &  initial,
const QString &  title,
const QString &  context = QString(),
const QStringList &  palettePaths = QStringList(),
QWidget *  parent = nullptr 
)
static

Utility function to quickly generate a ColorPicker dialog.

Parameters
configurationThe color Configuration for the ColorPicker.
initialThe color selected by default when the dialog is opened.
titleThe title of the dialog window.
contextContext name, used to store settings and window sizing. Leave empty to use the default context.
palettePathsPaths to folders containing palette files. If not empty, all files in every folder will be loaded in the dialog alongside the default palette.
parentPointer to the parent widget.
Returns
The color selected by the user.

◆ loadConfig()

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

Sets the ColorPicker style configuration.

Parameters
settingsThe settings object to load the configuration from.
Returns
The new configuration of the ColorPicker.

◆ selectedColorChanged

void AzQtComponents::ColorPicker::selectedColorChanged ( const AZ::Color &  color)
signal

Triggered when the selected color is changed.

Parameters
colorThe new selected color.

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