18#include <QAbstractScrollArea>
89 void markField(
int start,
int length,
bool scroll_to =
true,
bool hover =
false)
override;
101 void markProtocol(
int start,
int length)
override{Q_UNUSED(start) Q_UNUSED(length)}
108 void markAppendix(
int start,
int length)
override{Q_UNUSED(start) Q_UNUSED(length)}
116 virtual void paintEvent(QPaintEvent *)
override;
126 virtual void showEvent(QShowEvent *)
override;
149 virtual void leaveEvent(QEvent *event)
override;
155 void updateLayoutMetrics();
162 int stringWidth(
const QString &line);
167 void updateScrollbars();
175 void addTextLine(
TextBlock &text_block,
TextLine &text_line,
const QString &next_line = QString());
183 bool prettyPrintPlain(
const char *in_buf, QString &out_str);
189 bool addJsonObject();
196 int offsetChars(
bool include_pad =
true);
209 const TextLine *findTextLine(
int line);
212 QTextLayout *layout_;
215 QList<TextBlock> text_blocks_;
230 qsizetype max_line_length_;
BaseDataSourceView(const QByteArray &data, QWidget *parent=nullptr)
Construct a BaseDataSourceView.
Definition base_data_source_view.h:31
virtual void leaveEvent(QEvent *event) override
Handles leave events to clear hover states.
Definition json_data_source_view.cpp:292
void unmarkField() override
Clears the currently marked field.
Definition json_data_source_view.cpp:114
void markField(int start, int length, bool scroll_to=true, bool hover=false) override
Visually marks a field in the display.
Definition json_data_source_view.cpp:84
void fieldSelected(FieldInformation *finfo)
Signal emitted when a JSON field is selected.
void markAppendix(int start, int length) override
Marks the appendix in the view (unused for JSON view).
Definition json_data_source_view.h:108
virtual void showEvent(QShowEvent *) override
Handles show events.
Definition json_data_source_view.cpp:183
~JsonDataSourceView()
Destroys the JsonDataSourceView.
Definition json_data_source_view.cpp:63
virtual void keyPressEvent(QKeyEvent *) override
Handles key press events for navigation.
Definition json_data_source_view.cpp:193
void markProtocol(int start, int length) override
Marks a protocol in the view (unused for JSON view).
Definition json_data_source_view.h:101
virtual void mousePressEvent(QMouseEvent *event) override
Handles mouse press events for selecting fields.
Definition json_data_source_view.cpp:260
void setMonospaceFont(const QFont &mono_font) override
Sets the monospace font used for rendering the JSON text.
Definition json_data_source_view.cpp:69
void fieldHighlight(FieldInformation *finfo)
Signal emitted when a JSON field is hovered or highlighted.
virtual void mouseMoveEvent(QMouseEvent *event) override
Handles mouse move events for hovering over fields.
Definition json_data_source_view.cpp:279
virtual void paintEvent(QPaintEvent *) override
Handles paint events to draw the JSON text.
Definition json_data_source_view.cpp:120
JsonDataSourceView(const QByteArray &data, proto_node *root_node, QWidget *parent=nullptr)
Constructs a new JsonDataSourceView.
Definition json_data_source_view.cpp:32
virtual void resizeEvent(QResizeEvent *) override
Handles resize events to adjust the text layout.
Definition json_data_source_view.cpp:178
struct _proto_node proto_node
Represents a logical block of text composed of one or more formatted lines.
Definition json_data_source_view.h:38
QList< TextLine > text_lines
Definition json_data_source_view.h:39
Represents a single line of text with associated formatting, highlight, and key-value span metadata.
Definition json_data_source_view.h:26
int highlight_start
Definition json_data_source_view.h:29
int kv_length
Definition json_data_source_view.h:32
int highlight_length
Definition json_data_source_view.h:30
QList< QTextLayout::FormatRange > fmt_list
Definition json_data_source_view.h:28
QString line
Definition json_data_source_view.h:27
int kv_start
Definition json_data_source_view.h:31