QGIS API Documentation  3.21.0-Master (5b68dc587e)
Public Types | Public Member Functions | List of all members
QgsCodeEditorColorScheme Class Reference

Defines a color scheme for use in QgsCodeEditor widgets. More...

#include <qgscodeeditorcolorscheme.h>

Public Types

enum class  ColorRole {
  Default , Keyword , Class , Method ,
  Decoration , Number , Comment , CommentLine ,
  CommentBlock , Background , Cursor , CaretLine ,
  SingleQuote , DoubleQuote , TripleSingleQuote , TripleDoubleQuote ,
  Operator , QuotedOperator , Identifier , QuotedIdentifier ,
  Tag , UnknownTag , MarginBackground , MarginForeground ,
  SelectionBackground , SelectionForeground , MatchedBraceBackground , MatchedBraceForeground ,
  Edge , Fold , Error , ErrorBackground ,
  FoldIconForeground , FoldIconHalo , IndentationGuide
}
 Color roles. More...
 

Public Member Functions

 QgsCodeEditorColorScheme (const QString &id=QString(), const QString &name=QString())
 Constructor for QgsCodeEditorColorScheme. More...
 
QColor color (ColorRole role) const
 Returns the color to use in the editor for the specified role. More...
 
QString id () const
 Returns the ID of the color scheme, which is a unique, non-translated identifier for the scheme. More...
 
QString name () const
 Returns the name of the color scheme, which is the translated, user-visible name of the scheme. More...
 
void setColor (ColorRole role, const QColor &color)
 Sets the color to use in the editor for the specified role. More...
 
void setColors (const QMap< ColorRole, QColor > &colors)
 Sets all colors for the scheme. More...
 

Detailed Description

Defines a color scheme for use in QgsCodeEditor widgets.

Since
QGIS 3.16

Definition at line 30 of file qgscodeeditorcolorscheme.h.

Member Enumeration Documentation

◆ ColorRole

Color roles.

Enumerator
Default 

Default text color.

Keyword 

Keyword color.

Class 

Class color.

Method 

Method color.

Decoration 

Decoration color.

Number 

Number color.

Comment 

Comment color.

CommentLine 

Line comment color.

CommentBlock 

Comment block color.

Background 

Background color.

Cursor 

Cursor color.

CaretLine 

Caret line color.

SingleQuote 

Single quote color.

DoubleQuote 

Double quote color.

TripleSingleQuote 

Triple single quote color.

TripleDoubleQuote 

Triple double quote color.

Operator 

Operator color.

QuotedOperator 

Quoted operator color.

Identifier 

Identifier color.

QuotedIdentifier 

Quoted identifier color.

Tag 

Tag color.

UnknownTag 

Unknown tag.

MarginBackground 

Margin background color.

MarginForeground 

Margin foreground color.

SelectionBackground 

Selection background color.

SelectionForeground 

Selection foreground color.

MatchedBraceBackground 

Matched brace background color.

MatchedBraceForeground 

Matched brace foreground color.

Edge 

Edge color.

Fold 

Fold color.

Error 

Error color.

ErrorBackground 

Error background color.

FoldIconForeground 

Fold icon foreground color.

FoldIconHalo 

Fold icon halo color.

IndentationGuide 

Indentation guide line.

Definition at line 37 of file qgscodeeditorcolorscheme.h.

Constructor & Destructor Documentation

◆ QgsCodeEditorColorScheme()

QgsCodeEditorColorScheme::QgsCodeEditorColorScheme ( const QString &  id = QString(),
const QString &  name = QString() 
)

Constructor for QgsCodeEditorColorScheme.

The id argument must be set to a unique, non-translated identifier for the color scheme.

The name argument must be set to a translated, user-visible descriptive name of the scheme.

Definition at line 18 of file qgscodeeditorcolorscheme.cpp.

Member Function Documentation

◆ color()

QColor QgsCodeEditorColorScheme::color ( QgsCodeEditorColorScheme::ColorRole  role) const

Returns the color to use in the editor for the specified role.

See also
setColor()

Definition at line 25 of file qgscodeeditorcolorscheme.cpp.

◆ id()

QString QgsCodeEditorColorScheme::id ( ) const
inline

Returns the ID of the color scheme, which is a unique, non-translated identifier for the scheme.

Definition at line 89 of file qgscodeeditorcolorscheme.h.

◆ name()

QString QgsCodeEditorColorScheme::name ( ) const
inline

Returns the name of the color scheme, which is the translated, user-visible name of the scheme.

Definition at line 94 of file qgscodeeditorcolorscheme.h.

◆ setColor()

void QgsCodeEditorColorScheme::setColor ( QgsCodeEditorColorScheme::ColorRole  role,
const QColor &  color 
)

Sets the color to use in the editor for the specified role.

See also
color()

Definition at line 30 of file qgscodeeditorcolorscheme.cpp.

◆ setColors()

void QgsCodeEditorColorScheme::setColors ( const QMap< ColorRole, QColor > &  colors)

Sets all colors for the scheme.

Note
Not available in Python bindings.

Definition at line 35 of file qgscodeeditorcolorscheme.cpp.


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