QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
QgsCompoundColorWidget Class Reference

A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel, color swatches, and a color sampler. More...

#include <qgscompoundcolorwidget.h>

Inheritance diagram for QgsCompoundColorWidget:
Inheritance graph
[legend]

Public Types

enum  Layout { LayoutDefault = 0 , LayoutVertical }
 Widget layout. More...
 

Public Slots

void setColor (const QColor &color)
 Sets the current color for the dialog.
 
void setPreviousColor (const QColor &color)
 Sets the color to show in an optional "previous color" section.
 
- Public Slots inherited from QgsPanelWidget
void acceptPanel ()
 Accept the panel.
 
void openPanel (QgsPanelWidget *panel)
 Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the showPanel signal for connected slots to handle the open event.
 

Signals

void currentColorChanged (const QColor &color)
 Emitted when the dialog's color changes.
 
- Signals inherited from QgsPanelWidget
void panelAccepted (QgsPanelWidget *panel)
 Emitted when the panel is accepted by the user.
 
void showPanel (QgsPanelWidget *panel)
 Emit when you require a panel to be show in the interface.
 
void widgetChanged ()
 Emitted when the widget state changes.
 

Public Member Functions

 QgsCompoundColorWidget (QWidget *parent=nullptr, const QColor &color=QColor(), Layout layout=LayoutDefault)
 Constructor for QgsCompoundColorWidget.
 
 ~QgsCompoundColorWidget () override
 
QColor color () const
 Returns the current color for the dialog.
 
void setAllowOpacity (bool allowOpacity)
 Sets whether opacity modification (transparency) is permitted for the color dialog.
 
void setColorModelEditable (bool colorModelEditable)
 Sets whether color model is editable or not.
 
void setDiscarded (bool discarded)
 Sets whether the widget's color has been "discarded" and the selected color should not be stored in the recent color list.
 
- Public Member Functions inherited from QgsPanelWidget
 QgsPanelWidget (QWidget *parent=nullptr)
 Base class for any widget that can be shown as a inline panel.
 
virtual bool applySizeConstraintsToStack () const
 Returns true if the size constraints and hints for the panel widget should be applied to the parent QgsPanelWidgetStack which this panel is shown in.
 
bool autoDelete ()
 The the auto delete property on the widget.
 
void connectChildPanel (QgsPanelWidget *panel)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user.
 
void connectChildPanels (const QList< QgsPanelWidget * > &panels)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user.
 
bool dockMode ()
 Returns the dock mode state.
 
virtual QMenu * menuButtonMenu ()
 Returns the menu to use for the menu button for this panel, or nullptr if no menu button is required.
 
virtual QString menuButtonTooltip () const
 Returns the (translated) tooltip text to use for the menu button for this panel.
 
QString panelTitle ()
 The title of the panel.
 
void setAutoDelete (bool autoDelete)
 The the auto delete property on the widget.
 
virtual void setDockMode (bool dockMode)
 Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
 
void setPanelTitle (const QString &panelTitle)
 Set the title of the panel when shown in the interface.
 

Static Public Member Functions

static QgsUserColorSchemecreateNewUserPalette (QWidget *parent)
 Triggers a user prompt for creating a new user color scheme.
 
static QgsUserColorSchemeimportUserPaletteFromFile (QWidget *parent)
 Triggers a user prompt for importing a new color scheme from an existing GPL file.
 
static bool removeUserPalette (QgsUserColorScheme *scheme, QWidget *parent)
 Triggers a user prompt for removing an existing user color scheme.
 
- Static Public Member Functions inherited from QgsPanelWidget
static QgsPanelWidgetfindParentPanel (QWidget *widget)
 Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
 

Protected Member Functions

void hideEvent (QHideEvent *e) override
 
void keyPressEvent (QKeyEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
- Protected Member Functions inherited from QgsPanelWidget
void keyPressEvent (QKeyEvent *event) override
 Overridden key press event to handle the esc event on the widget.
 

Friends

class TestQgsCompoundColorWidget
 

Detailed Description

A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel, color swatches, and a color sampler.

Definition at line 34 of file qgscompoundcolorwidget.h.

Member Enumeration Documentation

◆ Layout

Widget layout.

Enumerator
LayoutDefault 

Use the default (rectangular) layout.

LayoutVertical 

Use a narrower, vertically stacked layout.

Definition at line 42 of file qgscompoundcolorwidget.h.

Constructor & Destructor Documentation

◆ QgsCompoundColorWidget()

QgsCompoundColorWidget::QgsCompoundColorWidget ( QWidget *  parent = nullptr,
const QColor &  color = QColor(),
Layout  layout = LayoutDefault 
)

Constructor for QgsCompoundColorWidget.

Parameters
parentparent widget
colorinitial color for dialog
layoutwidget layout to use

Definition at line 39 of file qgscompoundcolorwidget.cpp.

◆ ~QgsCompoundColorWidget()

QgsCompoundColorWidget::~QgsCompoundColorWidget ( )
override

Definition at line 322 of file qgscompoundcolorwidget.cpp.

Member Function Documentation

◆ color()

QColor QgsCompoundColorWidget::color ( ) const

Returns the current color for the dialog.

Returns
dialog color

Definition at line 330 of file qgscompoundcolorwidget.cpp.

◆ createNewUserPalette()

QgsUserColorScheme * QgsCompoundColorWidget::createNewUserPalette ( QWidget *  parent)
static

Triggers a user prompt for creating a new user color scheme.

The parent argument must be set to a valid parent widget for the dialog prompts.

See also
importUserPaletteFromFile()
removeUserPalette()
Since
QGIS 3.2

Definition at line 476 of file qgscompoundcolorwidget.cpp.

◆ currentColorChanged

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

Emitted when the dialog's color changes.

Parameters
colorcurrent color

◆ hideEvent()

void QgsCompoundColorWidget::hideEvent ( QHideEvent *  e)
overrideprotected

Definition at line 780 of file qgscompoundcolorwidget.cpp.

◆ importUserPaletteFromFile()

QgsUserColorScheme * QgsCompoundColorWidget::importUserPaletteFromFile ( QWidget *  parent)
static

Triggers a user prompt for importing a new color scheme from an existing GPL file.

The parent argument must be set to a valid parent widget for the dialog prompts.

See also
createNewUserPalette()
removeUserPalette()
Since
QGIS 3.2

Definition at line 369 of file qgscompoundcolorwidget.cpp.

◆ keyPressEvent()

void QgsCompoundColorWidget::keyPressEvent ( QKeyEvent *  e)
overrideprotected

Definition at line 877 of file qgscompoundcolorwidget.cpp.

◆ mouseMoveEvent()

void QgsCompoundColorWidget::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 848 of file qgscompoundcolorwidget.cpp.

◆ mousePressEvent()

void QgsCompoundColorWidget::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 786 of file qgscompoundcolorwidget.cpp.

◆ mouseReleaseEvent()

void QgsCompoundColorWidget::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 864 of file qgscompoundcolorwidget.cpp.

◆ removeUserPalette()

bool QgsCompoundColorWidget::removeUserPalette ( QgsUserColorScheme scheme,
QWidget *  parent 
)
static

Triggers a user prompt for removing an existing user color scheme.

The parent argument must be set to a valid parent widget for the dialog prompts.

See also
importUserPaletteFromFile()
createNewUserPalette()
Since
QGIS 3.2

Definition at line 429 of file qgscompoundcolorwidget.cpp.

◆ setAllowOpacity()

void QgsCompoundColorWidget::setAllowOpacity ( bool  allowOpacity)

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

Defaults to true.

Parameters
allowOpacityset to false to disable opacity modification

Definition at line 337 of file qgscompoundcolorwidget.cpp.

◆ setColor

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

Sets the current color for the dialog.

Parameters
colordesired color

Definition at line 729 of file qgscompoundcolorwidget.cpp.

◆ setColorModelEditable()

void QgsCompoundColorWidget::setColorModelEditable ( bool  colorModelEditable)

Sets whether color model is editable or not.

Parameters
colorModelEditableset to false to disable color model modification Defaults to true.
Since
QGIS 3.40

Definition at line 350 of file qgscompoundcolorwidget.cpp.

◆ setDiscarded()

void QgsCompoundColorWidget::setDiscarded ( bool  discarded)
inline

Sets whether the widget's color has been "discarded" and the selected color should not be stored in the recent color list.

Parameters
discardedset to true to avoid adding color to recent color list on widget destruction.

Definition at line 84 of file qgscompoundcolorwidget.h.

◆ setPreviousColor

void QgsCompoundColorWidget::setPreviousColor ( const QColor &  color)
slot

Sets the color to show in an optional "previous color" section.

Parameters
colorprevious color

Definition at line 774 of file qgscompoundcolorwidget.cpp.

Friends And Related Symbol Documentation

◆ TestQgsCompoundColorWidget

friend class TestQgsCompoundColorWidget
friend

Definition at line 247 of file qgscompoundcolorwidget.h.


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