edbee - Qt Editor Library
texteditorconfig.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QFont>
9 #include <QObject>
10 #include <QPen>
11 #include <QString>
12 #include <QStringList>
13 
14 namespace edbee {
15 
17 class TextEditorConfig : public QObject
18 {
19 Q_OBJECT
20 
21 public:
22 
27  };
29 
30 
31 
32  TextEditorConfig( QObject* parent=0 );
33  virtual ~TextEditorConfig();
34 
35  void beginChanges();
36  void endChanges();
37 
38  int caretWidth() const;
39  void setCaretWidth( int width );
40 
41  int caretBlinkingRate() const;
42  void setCaretBlinkRate( int rate );
43 
44  int indentSize() const;
45  void setIndentSize( int size );
46 
47  bool useTabChar() const;
48  void setUseTabChar( bool enable );
49 
50  bool smartTab() const;
51  void setSmartTab( bool enable );
52 
53  const QStringList& charGroups() const;
54  void setCharGroups( const QStringList& items );
55 
56  const QString& whitespaces() const;
57  void setWhitespaces( const QString& value );
58 
59  const QString& whitespaceWithoutNewline() const;
60  void setWhitespaceWithoutNewline( const QString& );
61 
62  int extraLineSpacing() const;
63  void setExtraLineSpacing( int value );
64 
65  bool useLineSeparator() const;
66  void setUseLineSeparator( bool value );
67 
68  const QPen& lineSeparatorPen() const;
69  void setLineSeperatorPen( const QPen& pen );
70 
71  bool undoGroupPerSpace() const;
72  void setUndoGroupPerSpace( bool enable );
73 
74  bool showCaretOffset() const;
75  void setShowCaretOffset( bool enable );
76 
77  QString themeName();
78  void setThemeName( const QString& name );
79 
80  QFont font() const ;
81  void setFont( const QFont& font );
82 
83  bool scrollPastEnd() const;
84  void setScrollPastEnd( bool enabled );
85 
86  int showWhitespaceMode() const;
87  void setShowWhitespaceMode( int mode );
88  void setShowWhitespaceMode( const QString& str );
89 
90 
91 signals:
92  void configChanged();
93 
94 protected:
95  void notifyChange();
96 
97 private:
98 
99  int changeInProgressLevel_;
100  int changeCount_;
101 
102  int caretWidth_;
103  int caretBlinkingRate_;
104  int indentSize_;
105  bool useTabChar_;
106  bool smartTab_;
107 
108  QStringList charGroups_;
109  QString whitespaces_;
110  QString whitespaceWithoutNewline_;
111  int extraLineSpacing_;
112  bool useLineSeparator_;
113  QPen lineSeparatorPen_;
114  bool undoGroupPerSpace_;
115  bool showCaretOffset_;
116  QString themeName_;
117  QFont font_;
118 
119  bool scrollPastEnd_;
120  int showWhitespaceMode_;
121 };
122 
123 } // edbee
int extraLineSpacing() const
Returns the extra line spacing in pixels.
Definition: texteditorconfig.cpp:219
const QPen & lineSeparatorPen() const
The line sperator pen to use.When the setting useLineSeparator is set this pen is used to draw lines ...
Definition: texteditorconfig.cpp:258
TextEditorConfig(QObject *parent=0)
The default constructor Fills this configuration object with some sane defaults.
Definition: texteditorconfig.cpp:16
void setLineSeperatorPen(const QPen &pen)
This method sets the line seperator pen that used to paint line between the text-lines.
Definition: texteditorconfig.cpp:267
bool useLineSeparator() const
Should we use a line seperator pen.
Definition: texteditorconfig.cpp:238
void setWhitespaces(const QString &value)
Sets the whitespace characters.
Definition: texteditorconfig.cpp:191
void beginChanges()
use this method to start a group of changes. Default behaviour is to emit a configChanged signal if a...
Definition: texteditorconfig.cpp:52
void setCharGroups(const QStringList &items)
Sets the character groups.
Definition: texteditorconfig.cpp:174
QFont font() const
returns the current font to use
Definition: texteditorconfig.cpp:336
void setSmartTab(bool enable)
Sets the smarttab mode.
Definition: texteditorconfig.cpp:153
bool useTabChar() const
Should the tab-character be used?
Definition: texteditorconfig.cpp:126
void notifyChange()
This internal method is used to notify the listener that a change has happend Thi smethod only emits ...
Definition: texteditorconfig.cpp:401
int showWhitespaceMode() const
Shows the whitespacemode.
Definition: texteditorconfig.cpp:373
void endChanges()
Ends the previous call of beginChanges. It will notify a change when all items have been changes...
Definition: texteditorconfig.cpp:60
General configuration settings of the text editor.
Definition: texteditorconfig.h:17
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
void setCaretBlinkRate(int rate)
Sets the caret blinking rate (delay) (lower means faster )
Definition: texteditorconfig.cpp:98
QString themeName()
returns the active theme name (The theme name is the name without the file-extension of the file in t...
Definition: texteditorconfig.cpp:318
Don&#39;t show whitespaces.
Definition: texteditorconfig.h:25
void setCaretWidth(int width)
Sets the caret render width in pixels.
Definition: texteditorconfig.cpp:79
void setIndentSize(int size)
Sets the indentsize in characters.
Definition: texteditorconfig.cpp:116
void setScrollPastEnd(bool enabled)
Sets the scroll past end option. When enabled the last line of the document is scrollable to the top ...
Definition: texteditorconfig.cpp:363
const QString & whitespaces() const
Returns all white-space characters.
Definition: texteditorconfig.cpp:184
void setExtraLineSpacing(int value)
Sets the extra line spacing between lines in pixels.
Definition: texteditorconfig.cpp:227
void setShowWhitespaceMode(int mode)
Sets the show the whitespace mode.
Definition: texteditorconfig.cpp:381
ShowWhitespaceMode
an enumeration with the possible types of whitespace showing
Definition: texteditorconfig.h:24
void setUseTabChar(bool enable)
Should the tab-character be used?
Definition: texteditorconfig.cpp:134
void setUndoGroupPerSpace(bool enable)
Sets the undo group per space value.
Definition: texteditorconfig.cpp:287
void setShowCaretOffset(bool enable)
Enables / disables the passing of the character offset.
Definition: texteditorconfig.cpp:307
void setFont(const QFont &font)
Changes the font that&#39;s used by the editor.
Definition: texteditorconfig.cpp:343
void configChanged()
Definition: moc_texteditorconfig.cpp:124
bool showCaretOffset() const
should the caret-offset been shown. The texteditor can signal a statusbar text to a slot...
Definition: texteditorconfig.cpp:299
void setWhitespaceWithoutNewline(const QString &)
Sets the characters that are considered whitespace. Excluding the newline character.
Definition: texteditorconfig.cpp:209
void setThemeName(const QString &name)
This method sets the active theme name.
Definition: texteditorconfig.cpp:326
int caretWidth() const
Returns the caret width in pixels.
Definition: texteditorconfig.cpp:71
const QString & whitespaceWithoutNewline() const
Retuns the whitespace character without newlines.
Definition: texteditorconfig.cpp:201
bool smartTab() const
Returns the state of smarttab mode Smarttab enables the automatic addition of indents.
Definition: texteditorconfig.cpp:145
int caretBlinkingRate() const
Returns the caret blinking rate (delay) (lower means faster ) The blinking delay is in milliseconds...
Definition: texteditorconfig.cpp:90
bool undoGroupPerSpace() const
Should a space result in a new &#39;undo-group&#39; The default behaviour is that pressing a space character ...
Definition: texteditorconfig.cpp:279
int indentSize() const
Returns the indent size in the number of characters.
Definition: texteditorconfig.cpp:108
Alsways show the whitespace.
Definition: texteditorconfig.h:26
bool scrollPastEnd() const
returns the scroll past end setting
Definition: texteditorconfig.cpp:354
virtual ~TextEditorConfig()
empty constructor :)
Definition: texteditorconfig.cpp:42
void setUseLineSeparator(bool value)
Should we use a sline seperator?
Definition: texteditorconfig.cpp:246
const QStringList & charGroups() const
Returns the characters groups Character groups are groups that considered the &#39;same&#39; kind of characte...
Definition: texteditorconfig.cpp:166