mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 08:28:06 +03:00
Define code style and format all source file using clang-format-14
except those placed in 3rdparty directories.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#ifndef LRCODEEDITOR_H
|
||||
#define LRCODEEDITOR_H
|
||||
|
||||
#include "lrscripthighlighter.h"
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include "lrscripthighlighter.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QWidget;
|
||||
@@ -12,58 +13,54 @@ class QKeyEvent;
|
||||
class QScrollBar;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class CodeEditor :public QPlainTextEdit
|
||||
{
|
||||
class CodeEditor: public QPlainTextEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CodeEditor(QWidget* parent=0);
|
||||
CodeEditor(QWidget* parent = 0);
|
||||
void setCompleter(QCompleter* value);
|
||||
QCompleter* compleater() const{ return m_completer;}
|
||||
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
||||
QCompleter* compleater() const { return m_completer; }
|
||||
void lineNumberAreaPaintEvent(QPaintEvent* event);
|
||||
int lineNumberAreaWidth();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void keyPressEvent(QKeyEvent* e);
|
||||
void focusInEvent(QFocusEvent* e);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
QString textUnderCursor() const;
|
||||
bool matchLeftParenthesis(QTextBlock currentBlock, QChar parenthesisType, int i, int numLeftParentheses);
|
||||
bool matchRightParenthesis(QTextBlock currentBlock, QChar parenthesisType, int i, int numRightParentheses);
|
||||
void createParenthesisSelection(int pos);
|
||||
bool charIsParenthesis(QChar character, ParenthesisType type);
|
||||
QChar getParenthesisReverceChar(QChar parenthesisChar);
|
||||
bool matchLeftParenthesis(QTextBlock currentBlock, QChar parenthesisType, int i,
|
||||
int numLeftParentheses);
|
||||
bool matchRightParenthesis(QTextBlock currentBlock, QChar parenthesisType, int i,
|
||||
int numRightParentheses);
|
||||
void createParenthesisSelection(int pos);
|
||||
bool charIsParenthesis(QChar character, ParenthesisType type);
|
||||
QChar getParenthesisReverceChar(QChar parenthesisChar);
|
||||
private slots:
|
||||
void insertCompletion(const QString& completion);
|
||||
void updateLineNumberAreaWidth(int newBlockCount);
|
||||
void highlightCurrentLine();
|
||||
void updateLineNumberArea(const QRect &rect, int dy);
|
||||
void updateLineNumberArea(const QRect& rect, int dy);
|
||||
void matchParentheses();
|
||||
|
||||
private:
|
||||
QCompleter* m_completer;
|
||||
QWidget *lineNumberArea;
|
||||
QWidget* lineNumberArea;
|
||||
};
|
||||
|
||||
|
||||
class LineNumberArea : public QWidget
|
||||
{
|
||||
class LineNumberArea: public QWidget {
|
||||
public:
|
||||
LineNumberArea(CodeEditor *editor) : QWidget(editor) {
|
||||
codeEditor = editor;
|
||||
}
|
||||
LineNumberArea(CodeEditor* editor): QWidget(editor) { codeEditor = editor; }
|
||||
|
||||
QSize sizeHint() const {
|
||||
return QSize(codeEditor->lineNumberAreaWidth(), 0);
|
||||
}
|
||||
QSize sizeHint() const { return QSize(codeEditor->lineNumberAreaWidth(), 0); }
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) {
|
||||
codeEditor->lineNumberAreaPaintEvent(event);
|
||||
}
|
||||
void paintEvent(QPaintEvent* event) { codeEditor->lineNumberAreaPaintEvent(event); }
|
||||
|
||||
private:
|
||||
CodeEditor *codeEditor;
|
||||
CodeEditor* codeEditor;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
Reference in New Issue
Block a user