24 #include <Qsci/qscilexerhtml.h> 39 void QgsCodeEditorHTML::setSciLexerHTML()
41 QHash< QString, QColor > colors;
45 for (
const auto &key : ini.allKeys() )
54 font.setPointSize( QLabel().font().pointSize() );
56 QColor defaultColor = colors.value( QStringLiteral(
"html/defaultFontColor" ), Qt::black );
58 QsciLexerHTML *lexer =
new QsciLexerHTML(
this );
59 lexer->setDefaultFont( font );
60 lexer->setDefaultColor( defaultColor );
61 lexer->setDefaultPaper( colors.value( QStringLiteral(
"html/paperBackgroundColor" ), Qt::white ) );
62 lexer->setFont( font, -1 );
64 lexer->setColor( defaultColor, QsciLexerHTML::Default );
65 lexer->setColor( colors.value( QStringLiteral(
"html/tagFontColor" ), QColor( 66, 113, 174 ) ), QsciLexerHTML::Tag );
66 lexer->setColor( colors.value( QStringLiteral(
"html/unknownTagFontColor" ), QColor( 255, 0, 0 ) ), QsciLexerHTML::UnknownTag );
67 lexer->setColor( colors.value( QStringLiteral(
"html/numberFontColor" ), QColor( 200, 40, 41 ) ), QsciLexerHTML::HTMLNumber );
68 lexer->setColor( colors.value( QStringLiteral(
"html/commentFontColor" ), QColor( 142, 144, 140 ) ), QsciLexerHTML::HTMLComment );
69 lexer->setColor( colors.value( QStringLiteral(
"html/singleQuoteFontColor" ), QColor( 113, 140, 0 ) ), QsciLexerHTML::HTMLSingleQuotedString );
70 lexer->setColor( colors.value( QStringLiteral(
"html/doubleQuoteFontColor" ), QColor( 113, 140, 0 ) ), QsciLexerHTML::HTMLDoubleQuotedString );
A text editor based on QScintilla2.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
void setFoldingVisible(bool folding)
Set folding visible state.
QgsCodeEditorHTML(QWidget *parent=nullptr)
Constructor for QgsCodeEditorHTML.
void setMarginVisible(bool margin)
Set margin visible state.
void setTitle(const QString &title)
Set the widget title.
static QColor decodeColor(const QString &str)