QGIS API Documentation  2.99.0-Master (8ec3eaf)
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsColorDialog Class Reference

A custom QGIS dialog for selecting a color. More...

#include <qgscolordialog.h>

Inheritance diagram for QgsColorDialog:
Inheritance graph
[legend]

Public Slots

void setColor (const QColor &color)
 Sets the current color for the dialog. More...
 

Signals

void currentColorChanged (const QColor &color)
 Emitted when the dialog's color changes. More...
 

Public Member Functions

 QgsColorDialog (QWidget *parent=nullptr, Qt::WindowFlags fl=QgisGui::ModalDialogFlags, const QColor &color=QColor())
 Create a new color picker dialog. More...
 
 ~QgsColorDialog ()
 
QColor color () const
 Returns the current color for the dialog. More...
 
void setAllowAlpha (const bool allowAlpha)
 Sets whether alpha modification (transparency) is permitted for the color dialog. More...
 
void setTitle (const QString &title)
 Sets the title for the color dialog. More...
 

Static Public Member Functions

static QColor getColor (const QColor &initialColor, QWidget *parent, const QString &title=QString(), const bool allowAlpha=false)
 Return a color selection from a color dialog. More...
 
static QColor getLiveColor (const QColor &initialColor, QObject *updateObject, const char *updateSlot, QWidget *parent=nullptr, const QString &title=QString(), const bool allowAlpha=true)
 Return a color selection from a color dialog, with live updating of interim selections. More...
 

Protected Member Functions

void closeEvent (QCloseEvent *e) override
 

Detailed Description

A custom QGIS dialog for selecting a color.

Has many improvements over the standard Qt color picker dialog, including hue wheel supports, color swatches, and a color sampler.

Note
Added in version 2.5

Definition at line 32 of file qgscolordialog.h.

Constructor & Destructor Documentation

§ QgsColorDialog()

QgsColorDialog::QgsColorDialog ( QWidget *  parent = nullptr,
Qt::WindowFlags  fl = QgisGui::ModalDialogFlags,
const QColor &  color = QColor() 
)

Create a new color picker dialog.

Parameters
parentparent widget
flwindow flags
colorinitial color for dialog

Definition at line 33 of file qgscolordialog.cpp.

§ ~QgsColorDialog()

QgsColorDialog::~QgsColorDialog ( )

Definition at line 61 of file qgscolordialog.cpp.

Member Function Documentation

§ closeEvent()

void QgsColorDialog::closeEvent ( QCloseEvent *  e)
overrideprotected

Definition at line 207 of file qgscolordialog.cpp.

§ color()

QColor QgsColorDialog::color ( ) const

Returns the current color for the dialog.

Returns
dialog color

Definition at line 66 of file qgscolordialog.cpp.

§ currentColorChanged

void QgsColorDialog::currentColorChanged ( const QColor &  color)
signal

Emitted when the dialog's color changes.

Parameters
colorcurrent color

§ getColor()

QColor QgsColorDialog::getColor ( const QColor &  initialColor,
QWidget *  parent,
const QString &  title = QString(),
const bool  allowAlpha = false 
)
static

Return a color selection from a color dialog.

Parameters
initialColorthe initial color of the selection dialog.
parentparent widget
titlethe title of the dialog.
allowAlphaset to true to allow modification of color alpha value (transparency)
Returns
Selected color on accepted() or initialColor on rejected().
See also
getLiveColor

Definition at line 127 of file qgscolordialog.cpp.

§ getLiveColor()

QColor QgsColorDialog::getLiveColor ( const QColor &  initialColor,
QObject *  updateObject,
const char *  updateSlot,
QWidget *  parent = nullptr,
const QString &  title = QString(),
const bool  allowAlpha = true 
)
static

Return a color selection from a color dialog, with live updating of interim selections.

Parameters
initialColorthe initial color of the selection dialog.
updateObjectthe receiver object of the live updating.
updateSlotthe receiver object's slot for live updating (e.g. SLOT( setValidColor( const QColor& ) ) ).
parentparent widget
titlethe title of the dialog.
allowAlphaset to true to allow modification of color alpha value (transparency)
Returns
Selected color on accepted() or initialColor on rejected().
See also
getColor

Definition at line 82 of file qgscolordialog.cpp.

§ setAllowAlpha()

void QgsColorDialog::setAllowAlpha ( const bool  allowAlpha)

Sets whether alpha modification (transparency) is permitted for the color dialog.

Defaults to true.

Parameters
allowAlphaset to false to disable alpha modification

Definition at line 76 of file qgscolordialog.cpp.

§ setColor

void QgsColorDialog::setColor ( const QColor &  color)
slot

Sets the current color for the dialog.

Parameters
colordesired color

Definition at line 189 of file qgscolordialog.cpp.

§ setTitle()

void QgsColorDialog::setTitle ( const QString &  title)

Sets the title for the color dialog.

Parameters
titletitle for dialog box

Definition at line 71 of file qgscolordialog.cpp.


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