CodeEditor improvements

- Block (un)indent (works for tabs and or spaces)
- Block indent inserts spaces when m_useTabs == false
- Tabsize based on number of chars (instead of pixels) default size is now 4 chars
- Change fontsize with Ctrl + [-|+|=] (= is same key as +)
This commit is contained in:
eelke 2018-12-28 15:26:24 +01:00
parent 69473d65d2
commit d129876d06
2 changed files with 128 additions and 1 deletions

View file

@ -18,8 +18,11 @@ public:
void addErrorMarker(int position, int length);
void clearErrorMarkers();
void setFont(const QFont &);
void setTabSize(int chars);
protected:
void resizeEvent(QResizeEvent *event) override;
void keyPressEvent(QKeyEvent *e) override;
signals:
@ -31,6 +34,7 @@ private slots:
void updateGutterArea(const QRect &, int);
void onTextChanged();
private:
QWidget *gutterArea;
@ -39,7 +43,13 @@ private:
std::set<int> errorLines;
// Settings
int m_tabSize = 0; // tabSize in characters
bool m_useTab = false;
void updateExtraSelections();
bool indentSelection(bool indent);
};
#endif // CODEEDITOR_H