QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsUserColorScheme Class Reference

A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the user's QGIS settings folder. More...

#include <qgscolorscheme.h>

Inheritance diagram for QgsUserColorScheme:
Inheritance graph
[legend]

Public Member Functions

 QgsUserColorScheme (const QString &filename)
 Constructs a new user color scheme, using a specified gpl palette file. More...
 
QgsUserColorSchemeclone () const override
 Clones a color scheme. More...
 
bool erase ()
 Erases the associated gpl palette file from the users "palettes" folder. More...
 
QgsColorScheme::SchemeFlags flags () const override
 Returns the current flags for the color scheme. More...
 
bool isEditable () const override
 Returns whether the color scheme is editable. More...
 
QString schemeName () const override
 Gets the name for the color scheme. More...
 
void setName (const QString &name)
 Sets the name for the scheme. More...
 
void setShowSchemeInMenu (bool show)
 Sets whether a this scheme should be shown in color button menus. More...
 
- Public Member Functions inherited from QgsGplColorScheme
 QgsGplColorScheme ()=default
 Constructor for QgsGplColorScheme. More...
 
QgsNamedColorList fetchColors (const QString &context=QString(), const QColor &baseColor=QColor()) override
 Gets a list of colors from the scheme. More...
 
bool setColors (const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor()) override
 Sets the colors for the scheme. More...
 
- Public Member Functions inherited from QgsColorScheme
 QgsColorScheme ()=default
 Constructor for QgsColorScheme. More...
 
virtual ~QgsColorScheme ()=default
 
virtual QgsColorSchemeclone () const =0
 Clones a color scheme. More...
 
virtual QgsNamedColorList fetchColors (const QString &context=QString(), const QColor &baseColor=QColor())=0
 Gets a list of colors from the scheme. More...
 
virtual SchemeFlags flags () const
 Returns the current flags for the color scheme. More...
 
virtual bool isEditable () const
 Returns whether the color scheme is editable. More...
 
virtual QString schemeName () const =0
 Gets the name for the color scheme. More...
 
virtual bool setColors (const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor())
 Sets the colors for the scheme. More...
 

Protected Member Functions

QString gplFilePath () override
 Returns the file path for the associated gpl palette file. More...
 
virtual QString gplFilePath ()=0
 Returns the file path for the associated gpl palette file. More...
 

Protected Attributes

bool mEditable = false
 
QString mFilename
 
QString mName
 

Additional Inherited Members

- Public Types inherited from QgsColorScheme
enum  SchemeFlag { ShowInColorDialog = 0x01 , ShowInColorButtonMenu = 0x02 , ShowInAllContexts = ShowInColorDialog | ShowInColorButtonMenu }
 Flags for controlling behavior of color scheme. More...
 
typedef QFlags< SchemeFlagSchemeFlags
 

Detailed Description

A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the user's QGIS settings folder.

Definition at line 171 of file qgscolorscheme.h.

Constructor & Destructor Documentation

◆ QgsUserColorScheme()

QgsUserColorScheme::QgsUserColorScheme ( const QString &  filename)

Constructs a new user color scheme, using a specified gpl palette file.

Parameters
filenamefilename of gpl palette file stored in the users "palettes" folder

Definition at line 291 of file qgscolorscheme.cpp.

Member Function Documentation

◆ clone()

QgsUserColorScheme * QgsUserColorScheme::clone ( ) const
overridevirtual

Clones a color scheme.

Returns
copy of color scheme

Implements QgsColorScheme.

Definition at line 334 of file qgscolorscheme.cpp.

◆ erase()

bool QgsUserColorScheme::erase ( )

Erases the associated gpl palette file from the users "palettes" folder.

Returns
true if erase was successful

Definition at line 354 of file qgscolorscheme.cpp.

◆ flags()

QgsColorScheme::SchemeFlags QgsUserColorScheme::flags ( ) const
overridevirtual

Returns the current flags for the color scheme.

Returns
current flags

Reimplemented from QgsColorScheme.

Definition at line 339 of file qgscolorscheme.cpp.

◆ gplFilePath()

QString QgsUserColorScheme::gplFilePath ( )
overrideprotectedvirtual

Returns the file path for the associated gpl palette file.

Returns
gpl file path

Implements QgsGplColorScheme.

Definition at line 389 of file qgscolorscheme.cpp.

◆ isEditable()

bool QgsUserColorScheme::isEditable ( ) const
inlineoverridevirtual

Returns whether the color scheme is editable.

Returns
true if scheme is editable
See also
setColors

Reimplemented from QgsColorScheme.

Definition at line 185 of file qgscolorscheme.h.

◆ schemeName()

QString QgsUserColorScheme::schemeName ( ) const
overridevirtual

Gets the name for the color scheme.

Returns
color scheme name

Implements QgsColorScheme.

Definition at line 329 of file qgscolorscheme.cpp.

◆ setName()

void QgsUserColorScheme::setName ( const QString &  name)
inline

Sets the name for the scheme.

Parameters
namenew name

Definition at line 193 of file qgscolorscheme.h.

◆ setShowSchemeInMenu()

void QgsUserColorScheme::setShowSchemeInMenu ( bool  show)

Sets whether a this scheme should be shown in color button menus.

Parameters
showset to true to show in color button menus, or false to hide from menus

Definition at line 372 of file qgscolorscheme.cpp.

Member Data Documentation

◆ mEditable

bool QgsUserColorScheme::mEditable = false
protected

Definition at line 213 of file qgscolorscheme.h.

◆ mFilename

QString QgsUserColorScheme::mFilename
protected

Definition at line 211 of file qgscolorscheme.h.

◆ mName

QString QgsUserColorScheme::mName
protected

Definition at line 209 of file qgscolorscheme.h.


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