QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsColorDialogV2 Class Reference

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

#include <qgscolordialog.h>

Public Slots

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

Signals

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

Public Member Functions

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

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.
static QColor getLiveColor (const QColor &initialColor, QObject *updateObject, const char *updateSlot, QWidget *parent=0, const QString &title=QString(), const bool allowAlpha=true)
 Return a color selection from a color dialog, with live updating of interim selections.

Protected Member Functions

void closeEvent (QCloseEvent *e) override
void keyPressEvent (QKeyEvent *e) override
void mouseMoveEvent (QMouseEvent *e) override
void mousePressEvent (QMouseEvent *e) override
void mouseReleaseEvent (QMouseEvent *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 62 of file qgscolordialog.h.

Constructor & Destructor Documentation

QgsColorDialogV2::QgsColorDialogV2 ( QWidget *  parent = 0,
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 69 of file qgscolordialog.cpp.

QgsColorDialogV2::~QgsColorDialogV2 ( )

Definition at line 276 of file qgscolordialog.cpp.

Member Function Documentation

void QgsColorDialogV2::closeEvent ( QCloseEvent *  e)
overrideprotected

Definition at line 812 of file qgscolordialog.cpp.

QColor QgsColorDialogV2::color ( void  ) const

Returns the current color for the dialog.

Returns
dialog color

Definition at line 281 of file qgscolordialog.cpp.

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

Emitted when the dialog's color changes.

Parameters
colorcurrent color
QColor QgsColorDialogV2::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 328 of file qgscolordialog.cpp.

QColor QgsColorDialogV2::getLiveColor ( const QColor &  initialColor,
QObject *  updateObject,
const char *  updateSlot,
QWidget *  parent = 0,
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 305 of file qgscolordialog.cpp.

void QgsColorDialogV2::keyPressEvent ( QKeyEvent *  e)
overrideprotected

Definition at line 898 of file qgscolordialog.cpp.

void QgsColorDialogV2::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 869 of file qgscolordialog.cpp.

void QgsColorDialogV2::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 818 of file qgscolordialog.cpp.

void QgsColorDialogV2::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 885 of file qgscolordialog.cpp.

void QgsColorDialogV2::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 293 of file qgscolordialog.cpp.

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

Sets the current color for the dialog.

Parameters
colordesired color

Definition at line 785 of file qgscolordialog.cpp.

void QgsColorDialogV2::setTitle ( const QString  title)

Sets the title for the color dialog.

Parameters
titletitle for dialog box

Definition at line 288 of file qgscolordialog.cpp.


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