QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
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 , SearchMatchBackground
}
 Color roles. More...
 

Public Member Functions

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

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.

SearchMatchBackground 

Background color for search matches.

Since
QGIS 3.38

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 90 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 95 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: