Skip to content
Permalink
Browse files
Add HTML code editor
  • Loading branch information
NathanW2 committed Jul 20, 2014
1 parent ac005b9 commit dcdd02be5b8037c15f2c267b7dd7b84be66756ae
Showing with 88 additions and 0 deletions.
  1. +2 −0 src/gui/CMakeLists.txt
  2. +47 −0 src/gui/qgscodeeditorhtml.cpp
  3. +39 −0 src/gui/qgscodeeditorhtml.h
@@ -129,6 +129,7 @@ qgscolordialog.cpp
qgscodeeditor.cpp
qgscodeeditorpython.cpp
qgscodeeditorsql.cpp
qgscodeeditorhtml.cpp
qgscomposerruler.cpp
qgscomposerview.cpp
qgsprevieweffect.cpp
@@ -322,6 +323,7 @@ qgscollapsiblegroupbox.h
qgscodeeditor.h
qgscodeeditorpython.h
qgscodeeditorsql.h
qgscodeeditorhtml.h
qgscolordialog.h
qgsprevieweffect.h
qgscomposerruler.h
@@ -0,0 +1,47 @@
/***************************************************************************
qgscodeeditorhtml.cpp - A HTML editor based on QScintilla
--------------------------------------
Date : 20-Jul-2014
Copyright : (C) 2014 by Nathan Woodrow
Email : woodrow.nathan (at) gmail (dot) com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsapplication.h"
#include "qgscodeeditorhtml.h"

#include <QWidget>
#include <QString>
#include <QFont>
#include <Qsci/qscilexerhtml.h>


QgsCodeEditorHTML::QgsCodeEditorHTML( QWidget *parent )
: QgsCodeEditor( parent )
{
if ( !parent )
{
setTitle( tr( "HTML Editor" ) );
}
setMarginVisible( false );
setFoldingVisible( true );
setSciLexerHTML();
}

QgsCodeEditorHTML::~QgsCodeEditorHTML()
{
}

void QgsCodeEditorHTML::setSciLexerHTML()
{
QsciLexerHTML* lexer = new QsciLexerHTML();
lexer->setDefaultFont( QFont( "Sans", 10 ) );

setLexer( lexer );
}
@@ -0,0 +1,39 @@
/***************************************************************************
qgscodeeditorhtml.h - A HTML editor based on QScintilla
--------------------------------------
Date : 20-Jul-2014
Copyright : (C) 2014 by Nathan Woodrow
Email : woodrow.nathan (at) gmail (dot) com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSCODEEDITORHTML_H
#define QGSCODEEDITORHTML_H

#include "qgscodeeditor.h"


/** \ingroup gui
* A HTML editor based on QScintilla2. Adds syntax highlighting and
* code autocompletion.
* \note added in 2.6
*/
class GUI_EXPORT QgsCodeEditorHTML : public QgsCodeEditor
{
Q_OBJECT

public:
QgsCodeEditorHTML( QWidget *parent = 0 );
~QgsCodeEditorHTML();

private:
void setSciLexerHTML();
};

#endif

0 comments on commit dcdd02b

Please sign in to comment.