修改设备显示信息的寄存器地址配置文件,修改服务端界面

This commit is contained in:
lixiaoyuan
2025-09-29 18:31:44 +08:00
parent af625fba49
commit 454310262b
23 changed files with 1000 additions and 334 deletions

View File

@@ -6,23 +6,54 @@
#include <QTableWidget>
#include <spdlog/sinks/base_sink.h>
#include <QObject>
class QtLogSink : public QObject, public spdlog::sinks::base_sink<std::mutex>
{
Q_OBJECT
public:
QtLogSink(QObject* parent = nullptr) : QObject(parent) {}
protected:
void sink_it_(const spdlog::details::log_msg& msg) override {
spdlog::memory_buf_t formatted;
spdlog::sinks::base_sink<std::mutex>::formatter_->format(msg, formatted);
QString logMessage = QString::fromStdString(fmt::to_string(formatted));
// 发射信号,传递日志消息
emit logMessageReceived(logMessage);
}
void flush_() override {}
signals:
void logMessageReceived(const QString& message);
};
class QWHome : public MyWidget
{
Q_OBJECT
public:
QWHome(QWidget* parent);
~QWHome();
void addPair(string name, QWidget* parent, int x, int y, string k, string v, bool readonly = true);
// 创建自定义sink
//std::shared_ptr<QtTextSink> qtSink;
std::map<string, MyPairLabelLine> mapPairs;
std::shared_ptr<QGroupBox> groupSys;
std::shared_ptr<QGroupBox> groupHttp;
std::shared_ptr<QGroupBox> groupMqtt;
std::shared_ptr<QGroupBox> groupDB;
std::shared_ptr<QTableWidget> table {};
std::shared_ptr<QTextEdit> textLog;
std::shared_ptr<QTextEdit> texteditLog;
MyPairLabelLine logFilter {};
std::shared_ptr<QPushButton> btnLogClean;
std::shared_ptr<QtLogSink> myqtSink;
void onTimer() override;
void setTableCell(int row, int col, std::string text, std::string style = "");
void onLogMessageReceived(const QString& message);
};