QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Public Member Functions | Protected Member Functions | Friends | List of all members
QgsCodeEditorSQL Class Reference

A SQL editor based on QScintilla2. More...

#include <qgscodeeditorsql.h>

Inheritance diagram for QgsCodeEditorSQL:
Inheritance graph
[legend]

Public Member Functions

 QgsCodeEditorSQL (QWidget *parent=nullptr)
 Constructor for QgsCodeEditorSQL. More...
 
virtual ~QgsCodeEditorSQL ()
 
QStringList extraKeywords () const
 Returns the extra keywords. More...
 
QStringList fieldNames () const
 Returns field names from the lexer API. More...
 
void setExtraKeywords (const QStringList &extraKeywords)
 Set extra keywords to extraKeywords. More...
 
void setFieldNames (const QStringList &fieldNames)
 Set field names to fieldNames to be added to the lexer API. More...
 
void setFields (const QgsFields &fields)
 Set field names to be added to the lexer API. More...
 
- Public Member Functions inherited from QgsCodeEditor
 QgsCodeEditor (QWidget *parent=nullptr, const QString &title=QString(), bool folding=false, bool margin=false)
 Construct a new code editor. More...
 
void addWarning (int lineNumber, const QString &warning)
 Adds a warning message and indicator to the specified a lineNumber. More...
 
void clearWarnings ()
 Clears all warning messages from the editor. More...
 
bool foldingVisible ()
 Returns true if the folding controls are visible in the editor. More...
 
void insertText (const QString &text)
 Insert text at cursor position, or replace any selected text if user has made a selection. More...
 
bool lineNumbersVisible () const
 Returns whether line numbers are visible in the editor. More...
 
Q_DECL_DEPRECATED bool marginVisible ()
 Returns whether margins are in a visible state. More...
 
void setCustomAppearance (const QString &scheme=QString(), const QMap< QgsCodeEditorColorScheme::ColorRole, QColor > &customColors=QMap< QgsCodeEditorColorScheme::ColorRole, QColor >(), const QString &fontFamily=QString(), int fontSize=0)
 Sets a custom appearance for the widget, disconnecting it from using the standard appearance taken from QSettings. More...
 
void setFoldingVisible (bool folding)
 Set whether the folding controls are visible in the editor. More...
 
void setLineNumbersVisible (bool visible)
 Sets whether line numbers should be visible in the editor. More...
 
Q_DECL_DEPRECATED void setMarginVisible (bool margin)
 Set margin visible state. More...
 
void setTitle (const QString &title)
 Set the widget title. More...
 

Protected Member Functions

void initializeLexer () override
 Called when the dialect specific code lexer needs to be initialized (or reinitialized). More...
 
- Protected Member Functions inherited from QgsCodeEditor
void focusOutEvent (QFocusEvent *event) override
 
bool isFixedPitch (const QFont &font)
 
void keyPressEvent (QKeyEvent *event) override
 
QColor lexerColor (QgsCodeEditorColorScheme::ColorRole role) const
 Returns the color to use in the lexer for the specified role. More...
 
QFont lexerFont () const
 Returns the font to use in the lexer. More...
 
void runPostLexerConfigurationTasks ()
 Performs tasks which must be run after a lexer has been set for the widget. More...
 

Friends

class TestQgsQueryResultWidget
 

Additional Inherited Members

- Public Types inherited from QgsCodeEditor
enum  MarginRole { LineNumbers = 0 , ErrorIndicators = 1 , FoldingControls = 2 }
 Margin roles. More...
 
- Static Public Member Functions inherited from QgsCodeEditor
static QColor color (QgsCodeEditorColorScheme::ColorRole role)
 Returns the color to use in the editor for the specified role. More...
 
static QColor defaultColor (QgsCodeEditorColorScheme::ColorRole role, const QString &theme=QString())
 Returns the default color for the specified role. More...
 
static QFont getMonospaceFont ()
 Returns the monospaced font to use for code editors. More...
 
static void setColor (QgsCodeEditorColorScheme::ColorRole role, const QColor &color)
 Sets the color to use in the editor for the specified role. More...
 

Detailed Description

A SQL editor based on QScintilla2.

Adds syntax highlighting and code autocompletion.

Note
may not be available in Python bindings, depending on platform support
Since
QGIS 2.6

Definition at line 34 of file qgscodeeditorsql.h.

Constructor & Destructor Documentation

◆ QgsCodeEditorSQL()

QgsCodeEditorSQL::QgsCodeEditorSQL ( QWidget *  parent = nullptr)

Constructor for QgsCodeEditorSQL.

Definition at line 25 of file qgscodeeditorsql.cpp.

◆ ~QgsCodeEditorSQL()

QgsCodeEditorSQL::~QgsCodeEditorSQL ( )
virtual

Definition at line 37 of file qgscodeeditorsql.cpp.

Member Function Documentation

◆ extraKeywords()

QStringList QgsCodeEditorSQL::extraKeywords ( ) const

Returns the extra keywords.

Extra keywords are usually added from provider connections and represent function and other provider specific keywords.

Since
QGIS 3.22

Definition at line 112 of file qgscodeeditorsql.cpp.

◆ fieldNames()

QStringList QgsCodeEditorSQL::fieldNames ( ) const

Returns field names from the lexer API.

Since
QGIS 3.22

Definition at line 123 of file qgscodeeditorsql.cpp.

◆ initializeLexer()

void QgsCodeEditorSQL::initializeLexer ( )
overrideprotectedvirtual

Called when the dialect specific code lexer needs to be initialized (or reinitialized).

The default implementation does nothing.

Since
QGIS 3.16

Reimplemented from QgsCodeEditor.

Definition at line 45 of file qgscodeeditorsql.cpp.

◆ setExtraKeywords()

void QgsCodeEditorSQL::setExtraKeywords ( const QStringList &  extraKeywords)

Set extra keywords to extraKeywords.

Extra keywords are usually added from provider connections and represent function and other provider specific keywords.

Since
QGIS 3.22

Definition at line 117 of file qgscodeeditorsql.cpp.

◆ setFieldNames()

void QgsCodeEditorSQL::setFieldNames ( const QStringList &  fieldNames)

Set field names to fieldNames to be added to the lexer API.

Since
QGIS 3.18

Definition at line 128 of file qgscodeeditorsql.cpp.

◆ setFields()

void QgsCodeEditorSQL::setFields ( const QgsFields fields)

Set field names to be added to the lexer API.

Since
QGIS 3.14

Definition at line 80 of file qgscodeeditorsql.cpp.

Friends And Related Function Documentation

◆ TestQgsQueryResultWidget

friend class TestQgsQueryResultWidget
friend

Definition at line 98 of file qgscodeeditorsql.h.


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