Files
uartscope/include/tagpanel.h

38 lines
1015 B
C++

#pragma once
#include <QWidget>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QDateTime>
#include <QList>
#include <QPair>
#include <QTableWidget>
// TagPanel displays the most recent data associated with a single tag (e.g. [WDG]).
// Values are parsed as key=value pairs, or shown as a raw string if no '=' is found.
// Example input line: [WDG] uptime=1234 temp=42.1 load=0.8
class TagPanel : public QGroupBox
{
Q_OBJECT
public:
explicit TagPanel(const QString &tag, QWidget *parent = nullptr);
const QString &tag() const { return m_tag; }
public slots:
void update(const QString &value);
private:
void parseKeyValue(const QString &value);
void showRaw(const QString &value);
void ensureRow(const QString &key);
QString m_tag;
QTableWidget *m_table = nullptr;
QLabel *m_rawLabel = nullptr;
QLabel *m_timestampLabel = nullptr;
QStringList m_keys; // ordered list for row lookup
};