Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
log_table_highlight.h
1#pragma once
2
3#include <QStyledItemDelegate>
4
8class LogHighlightDelegate : public QStyledItemDelegate
9{
10 Q_OBJECT
11
12public:
18 LogHighlightDelegate(QObject* parent = nullptr);
19
25 void setSearchText(const QString& text);
26
32 void addExpandedRow(int row);
33
39 void removeExpandedRow(int row);
40
48 bool containExpandedRow(int row) const;
49
53 void clearExpandedRows();
54
58 void updatePadding(int hPadding, int vPadding);
59
67 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
68
76 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
77
78private:
79 QString mSearchText;
80 QVector<int> mExpandedRows = {};
81 int mMatches = 0;
82
84 int mExpandedVPadding = 7;
85
86 void paintSearchHighlights(QPainter* painter, const QStyleOptionViewItem& option, const QRect& textRect, const QString& text, bool wordWrap) const;
87};
void addExpandedRow(int row)
Adds a row to the list of expanded rows.
Definition log_table_highlight.cpp:19
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints an item in a given style option and model index.
Definition log_table_highlight.cpp:166
void removeExpandedRow(int row)
Removes a row from the list of expanded rows.
Definition log_table_highlight.cpp:24
void setSearchText(const QString &text)
Sets the search text used for highlighting log entries.
Definition log_table_highlight.cpp:14
bool containExpandedRow(int row) const
Checks if a specific row is in the list of expanded rows.
Definition log_table_highlight.cpp:29
LogHighlightDelegate(QObject *parent=nullptr)
Constructs a new LogHighlightDelegate object.
Definition log_table_highlight.cpp:9
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the size hint for a given item view option and model index.
Definition log_table_highlight.cpp:45
int mExpandedHPadding
Number of matches found during the last search.
Definition log_table_highlight.h:83
QVector< int > mExpandedRows
The current search text used for highlighting log entries.
Definition log_table_highlight.h:80
int mMatches
List of rows that are currently expanded.
Definition log_table_highlight.h:81
void updatePadding(int hPadding, int vPadding)
Update the internal padding for expanded rows.
Definition log_table_highlight.cpp:39
void clearExpandedRows()
Clears all expanded rows.
Definition log_table_highlight.cpp:34