QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscodeeditor.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscodeeditor.h - A base code editor for QGIS and plugins. Provides
3  a base editor using QScintilla for editors
4  --------------------------------------
5  Date : 06-Oct-2013
6  Copyright : (C) 2013 by Salvatore Larosa
7  Email : lrssvtml (at) gmail (dot) com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSCODEEDITOR_H
18 #define QGSCODEEDITOR_H
19 
20 #include <QString>
21 // qscintilla includes
22 #include <Qsci/qsciapis.h>
23 
24 
25 class QWidget;
26 
31 class GUI_EXPORT QgsCodeEditor : public QsciScintilla
32 {
33  Q_OBJECT
34 
35  public:
45  QgsCodeEditor( QWidget *parent = 0, QString title = "", bool folding = false, bool margin = false );
46  ~QgsCodeEditor();
47 
51  void setTitle( const QString title );
52 
56  void setMarginVisible( bool margin );
57  bool marginVisible() { return mMargin; }
58 
62  void setFoldingVisible( bool folding );
63  bool foldingVisible() { return mFolding; }
64 
69  void insertText( const QString theText );
70 
71  protected:
72 
73  bool isFixedPitch( const QFont& font );
74 
75  QFont getMonospaceFont();
76 
77  private:
78 
79  void setSciWidget();
80 
81  QString mWidgetTitle;
82  bool mFolding;
83  bool mMargin;
84 };
85 
86 #endif
A text editor based on QScintilla2.
Definition: qgscodeeditor.h:31
bool marginVisible()
Definition: qgscodeeditor.h:57
bool foldingVisible()
Definition: qgscodeeditor.h:63