Files
uartscope/include/rawview.h

46 lines
1.2 KiB
C++

#pragma once
#include <QWidget>
#include <QPlainTextEdit>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QCheckBox>
#include <QLabel>
#include <QSpinBox>
// RawView shows the raw UART output in a QPlainTextEdit with:
// - Configurable maximum line count (default: unlimited / very large)
// - Auto-scroll that pauses when the user scrolls up
// - Horizontal scroll (word wrap off)
// - Incremental text search
// - Clear button
class RawView : public QWidget
{
Q_OBJECT
public:
explicit RawView(QWidget *parent = nullptr);
public slots:
void appendLine(const QString &line);
void clear();
private slots:
void onSearch(const QString &text);
void onScrollValueChanged(int value);
void onAutoScrollToggled(bool enabled);
private:
void setupUi();
void applyColorScheme();
QPlainTextEdit *m_textEdit = nullptr;
QLineEdit *m_searchEdit = nullptr;
QPushButton *m_clearBtn = nullptr;
QCheckBox *m_autoScrollCb = nullptr;
QLabel *m_lineCountLbl = nullptr;
bool m_autoScroll = true;
int m_lineCount = 0;
};