
- Added ProjectManager class to handle project operations including opening, closing, building, and running projects. - Introduced SyntaxHighlighter class for syntax highlighting in C and C++ files. - Developed TerminalWidget for command execution and output display. - Created TextEditor with line numbering and auto-indentation features. - Established main application entry point in main.cpp. - Designed UI layout for MainWindow using Qt Designer.
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <QtGui/QSyntaxHighlighter>
|
|
#include <QtGui/QTextDocument>
|
|
#include <QtGui/QTextCharFormat>
|
|
#include <QtCore/QRegularExpression>
|
|
|
|
class SyntaxHighlighter : public QSyntaxHighlighter
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SyntaxHighlighter(QTextDocument *parent = nullptr);
|
|
~SyntaxHighlighter();
|
|
|
|
void setLanguage(const QString &language);
|
|
QString language() const;
|
|
|
|
protected:
|
|
void highlightBlock(const QString &text) override;
|
|
|
|
private:
|
|
struct HighlightingRule
|
|
{
|
|
QRegularExpression pattern;
|
|
QTextCharFormat format;
|
|
};
|
|
QVector<HighlightingRule> m_highlightingRules;
|
|
|
|
void setupCppHighlighting();
|
|
void setupCHighlighting();
|
|
void setupCommonRules();
|
|
|
|
QTextCharFormat m_keywordFormat;
|
|
QTextCharFormat m_classFormat;
|
|
QTextCharFormat m_singleLineCommentFormat;
|
|
QTextCharFormat m_multiLineCommentFormat;
|
|
QTextCharFormat m_quotationFormat;
|
|
QTextCharFormat m_functionFormat;
|
|
QTextCharFormat m_numberFormat;
|
|
QTextCharFormat m_preprocessorFormat;
|
|
|
|
QRegularExpression m_commentStartExpression;
|
|
QRegularExpression m_commentEndExpression;
|
|
|
|
QString m_language;
|
|
};
|