39 lines
777 B
C++
39 lines
777 B
C++
#ifndef QLOGVIEWER_H
|
|
#define QLOGVIEWER_H
|
|
|
|
#include "qlogmanager.h" // 包含日志管理器
|
|
#include <QWidget>
|
|
#include <QTextEdit>
|
|
#include <QComboBox>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
|
|
class QLogViewer : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit QLogViewer(QWidget *parent = nullptr);
|
|
|
|
public slots:
|
|
void appendLog(QLogManager::LogLevel level, const QString& logLine);
|
|
void filterLogs();
|
|
void saveLogs();
|
|
|
|
private:
|
|
void applyFilter();
|
|
|
|
QComboBox* levelCombo;
|
|
QLineEdit* searchEdit;
|
|
QTextEdit* logText;
|
|
QPushButton* clearBtn;
|
|
QPushButton* saveBtn;
|
|
|
|
// 日志缓存
|
|
QList<QPair<QLogManager::LogLevel, QString>> logCache;
|
|
};
|
|
|
|
#endif // QLOGVIEWER_H
|