Skip to content
Permalink
Browse files

Fix rendering of CSS comments in QgsCodeEditorCSS

  • Loading branch information
nyalldawson committed Oct 7, 2020
1 parent 4996144 commit 3f40dbfb100fc07ca80262b97adf1e9e7fd5d934
@@ -10,6 +10,8 @@





class QgsCodeEditorCSS : QgsCodeEditor
{
%Docstring
@@ -36,7 +36,7 @@ QgsCodeEditorCSS::QgsCodeEditorCSS( QWidget *parent )

void QgsCodeEditorCSS::initializeLexer()
{
QsciLexerCSS *lexer = new QsciLexerCSS( this );
QsciLexerCSS *lexer = new QgsQsciLexerCSS( this );

QFont font = lexerFont();
lexer->setDefaultFont( font );
@@ -71,3 +71,21 @@ void QgsCodeEditorCSS::initializeLexer()

setLexer( lexer );
}

//
// QgsQsciLexerCSS
//
QgsQsciLexerCSS::QgsQsciLexerCSS( QObject *parent )
: QsciLexerCSS( parent )
{

}

QString QgsQsciLexerCSS::description( int style ) const
{
// see https://www.riverbankcomputing.com/pipermail/qscintilla/2019-July/001415.html
if ( style == QsciLexerCSS::Comment )
return QStringLiteral( "Comment" );

return QsciLexerCSS::description( style );
}
@@ -19,10 +19,27 @@
#include "qgscodeeditor.h"
#include "qgis_sip.h"
#include "qgis_gui.h"
#include <Qsci/qscilexercss.h>

SIP_IF_MODULE( HAVE_QSCI_SIP )


#ifndef SIP_RUN
///@cond PRIVATE
class QgsQsciLexerCSS : public QsciLexerCSS
{
Q_OBJECT
public:

QgsQsciLexerCSS( QObject *parent = nullptr );

QString description( int style ) const override;

};
///@endcond
#endif


/**
* \ingroup gui
* A CSS editor based on QScintilla2. Adds syntax highlighting and

0 comments on commit 3f40dbf

Please sign in to comment.
You can’t perform that action at this time.