QGIS API Documentation  2.14.0-Essen
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 
32 class GUI_EXPORT QgsCodeEditor : public QsciScintilla
33 {
34  Q_OBJECT
35 
36  public:
46  QgsCodeEditor( QWidget *parent = nullptr, const QString& title = "", bool folding = false, bool margin = false );
47  ~QgsCodeEditor();
48 
52  void setTitle( const QString& title );
53 
57  void setMarginVisible( bool margin );
58  bool marginVisible() { return mMargin; }
59 
63  void setFoldingVisible( bool folding );
64  bool foldingVisible() { return mFolding; }
65 
70  void insertText( const QString& theText );
71 
72  protected:
73 
74  bool isFixedPitch( const QFont& font );
75 
76  QFont getMonospaceFont();
77 
78  private:
79 
80  void setSciWidget();
81 
82  QString mWidgetTitle;
83  bool mFolding;
84  bool mMargin;
85 };
86 
87 #endif
A text editor based on QScintilla2.
Definition: qgscodeeditor.h:32
bool marginVisible()
Definition: qgscodeeditor.h:58
bool foldingVisible()
Definition: qgscodeeditor.h:64