#pragma once #include #include #include #include #include #include #include #include #include // TableView interprets UART lines as delimited data and shows them in a table. class TableView : public QWidget { Q_OBJECT public: explicit TableView(QWidget *parent = nullptr); public slots: void appendLine(const QString &line); void clear(); private slots: void onDelimiterChanged(int index); void onMaxRowsChanged(); void rebuildTable(); private: void parseHeaders(const QString &line); bool tryAppendRow(const QString &line); QTableWidget *m_table = nullptr; QComboBox *m_delimCombo = nullptr; QLineEdit *m_maxRowsEdit = nullptr; QPushButton *m_clearBtn = nullptr; QCheckBox *m_autoScrollCb = nullptr; QStringList m_headers; QList m_rows; int m_maxRows = 500; char m_delimiter = ','; bool m_autoScroll = true; bool m_headersSet = false; };