Skip to content

Commit

Permalink
Add HTML code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jul 20, 2014
1 parent ac005b9 commit dcdd02b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ qgscolordialog.cpp
qgscodeeditor.cpp
qgscodeeditorpython.cpp
qgscodeeditorsql.cpp
qgscodeeditorhtml.cpp
qgscomposerruler.cpp
qgscomposerview.cpp
qgsprevieweffect.cpp
Expand Down Expand Up @@ -322,6 +323,7 @@ qgscollapsiblegroupbox.h
qgscodeeditor.h
qgscodeeditorpython.h
qgscodeeditorsql.h
qgscodeeditorhtml.h
qgscolordialog.h
qgsprevieweffect.h
qgscomposerruler.h
Expand Down
47 changes: 47 additions & 0 deletions src/gui/qgscodeeditorhtml.cpp
Original file line number Diff line number Diff line change
@@ -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 );
}
39 changes: 39 additions & 0 deletions src/gui/qgscodeeditorhtml.h
Original file line number Diff line number Diff line change
@@ -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.