QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
18 #ifndef QGSCOLORSCHEME_H
19 #define QGSCOLORSCHEME_H
26 #include "qgis_core.h"
52 sipType = sipType_QgsUserColorScheme;
54 sipType = sipType_QgsRecentColorScheme;
56 sipType = sipType_QgsCustomColorScheme;
58 sipType = sipType_QgsProjectColorScheme;
60 sipType = sipType_QgsGplColorScheme;
62 sipType = sipType_QgsColorScheme;
73 ShowInColorDialog = 0x01,
74 ShowInColorButtonMenu = 0x02,
75 ShowInAllContexts = ShowInColorDialog | ShowInColorButtonMenu
77 Q_DECLARE_FLAGS( SchemeFlags, SchemeFlag )
90 virtual QString schemeName() const = 0;
96 virtual SchemeFlags flags()
const {
return ShowInColorDialog; }
110 const QColor &baseColor = QColor() ) = 0;
127 virtual bool setColors(
const QgsNamedColorList &colors,
const QString &context = QString(),
const QColor &baseColor = QColor() );
154 const QColor &baseColor = QColor() )
override;
156 bool setColors(
const QgsNamedColorList &colors,
const QString &context = QString(),
const QColor &baseColor = QColor() )
override;
191 QgsColorScheme::SchemeFlags
flags()
const override;
197 void setName(
const QString &name ) { mName = name; }
210 void setShowSchemeInMenu(
bool show );
218 bool mEditable =
false;
239 QString
schemeName()
const override {
return QObject::tr(
"Recent colors" ); }
244 const QColor &baseColor = QColor() )
override;
254 static
void addRecentColor( const QColor &color );
261 static QColor lastUsedColor();
279 QString
schemeName()
const override {
return QObject::tr(
"Standard colors" ); }
284 const QColor &baseColor = QColor() )
override;
288 bool setColors(
const QgsNamedColorList &colors,
const QString &context = QString(),
const QColor &baseColor = QColor() )
override;
308 QString
schemeName()
const override {
return QObject::tr(
"Project colors" ); }
313 const QColor &baseColor = QColor() )
override;
317 bool setColors(
const QgsNamedColorList &colors,
const QString &context = QString(),
const QColor &baseColor = QColor() )
override;
virtual SchemeFlags flags() const
Returns the current flags for the color scheme.
virtual QgsColorScheme * clone() const =0
Clones a color scheme.
bool isEditable() const override
Returns whether the color scheme is editable.
A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the ...
QgsRecentColorScheme()=default
Constructor for QgsRecentColorScheme.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
A color scheme which contains project specific colors set through project properties dialog.
QString schemeName() const override
Gets the name for the color scheme.
@ ShowInAllContexts
Show scheme in all contexts.
bool isEditable() const override
Returns whether the color scheme is editable.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
SchemeFlags flags() const override
Returns the current flags for the color scheme.
virtual QString gplFilePath()=0
Returns the file path for the associated gpl palette file.
void setName(const QString &name)
Sets the name for the scheme.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QString schemeName() const override
Gets the name for the color scheme.
SchemeFlags flags() const override
Returns the current flags for the color scheme.
bool isEditable() const override
Returns whether the color scheme is editable.
QString schemeName() const override
Gets the name for the color scheme.
A color scheme which stores its colors in a gpl palette file.
virtual QString schemeName() const =0
Gets the name for the color scheme.
QgsGplColorScheme()=default
Constructor for QgsGplColorScheme.
QgsCustomColorScheme()=default
Constructor for QgsCustomColorScheme.
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor())=0
Gets a list of colors from the scheme.
Abstract base class for color schemes.
A color scheme which contains custom colors set through QGIS app options dialog.
SchemeFlag
Flags for controlling behavior of color scheme.
A color scheme which contains the most recently used colors.
SchemeFlags flags() const override
Returns the current flags for the color scheme.
virtual bool isEditable() const
Returns whether the color scheme is editable.
QgsProjectColorScheme()=default
Constructor for QgsProjectColorScheme.
virtual bool setColors(const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor())
Sets the colors for the scheme.