Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
LogTableWidget Class Reference

A widget for displaying log tables with filtering and search functionality. More...

#include <log_table_widget.h>

Inheritance diagram for LogTableWidget:

Public Member Functions

 LogTableWidget (QWidget *parent=nullptr)
 Constructs a new LogTableWidget.
void append (logging::LogLevel level, const QString &source, const QString &file, const uint32_t line, const QString &message)
 Appends a log message with a QString source and file.
void append (logging::LogLevel level, const std::string &source, const std::string &file, const uint32_t line, const std::string &message)
 Appends a log message with a std::string source and file.
void clear ()
 Clears all log messages from the table.
void search ()
 Initiates a search for the current search text.
void showAll ()
 Expand all the expandable widgets.

Private Slots

void onAreaExpanded (ClickableIcon *button, QLineEdit *lineEdit)
 Handles area expansion events.
void onAreaCollapsed (ClickableIcon *button, QLineEdit *lineEdit, const QString &iconName)
 Handles area collapse events.
void onClicked (const QModelIndex &index)
 Handles click events on table items.

Private Member Functions

void setSearchText (const QString &text)
 Sets the search text and updates the search matches.
void nextSearchMatch ()
 Moves to the next search match.
void previousSearchMatch ()
 Moves to the previous search match.
void rebuildSearchMatches ()
 Rebuilds the list of search matches.
void focusCurrentSearchMatch ()
 Focuses on the current search match.
void updateSearchCounter ()
 Updates the search counter label.
QVector< int > selectedRows () const
 Returns a vector of selected row indices.
void showContextMenu (const QPoint &pos)
 Shows the context menu at the specified position.
void copySelectedRows () const
 Copies the selected rows to the clipboard.
void copySelectedColumn (int column) const
 Copies a specific column of the selected rows to the clipboard.
void copySelectedColumns (std::initializer_list< int > columns) const
 Copies multiple columns of the selected rows to the clipboard.
bool isMessageElided (int proxyRow) const
 Checks if a message is elided in the table.
bool eventFilter (QObject *watched, QEvent *event)
 Filters events for child widgets.
void updateFilterText (QToolButton *button, const QString &base)
 Updates the text in a toolbutton filter.

Private Attributes

LogFilterProxyModel * mProxy = nullptr
 Pointer to the log table model.
QTableView * mTable = nullptr
 Pointer to the log filter proxy model.
DropDownButton * mLevelFilter = nullptr
 Pointer to the table view widget.
DropDownButton * mSourceFilter = nullptr
 Pointer to the level filter button.
QLineEdit * mFileFilter = nullptr
 Pointer to the source filter button.
QLineEdit * mSearchField = nullptr
 Pointer to the file filter line edit.
QLabel * mSearchCounterLabel = nullptr
 Pointer to the search field line edit.
ExpandingWidget * mSearchBox = nullptr
 Pointer to the search counter label.
ExpandingWidget * mFilterBox = nullptr
 Pointer to the search box widget.
LogHighlightDelegate * mHighlightDelegate = nullptr
 Pointer to the filter box widget.
QString mSearchText
 Pointer to the log highlight delegate.
QVector< QModelIndex > mSearchMatches
 The current search text.
QSet< QString > mSources
 List of search matches.
int mCurrentSearchMatch = -1
 Set of sources for filtering.
int mDefaultRowHeight = 24
 Index of the current search match.
int mMaximumRows = 1000
 Default row height in pixels.

Detailed Description

A widget for displaying log tables with filtering and search functionality.

Constructor & Destructor Documentation

◆ LogTableWidget()

LogTableWidget::LogTableWidget ( QWidget * parent = nullptr)

Constructs a new LogTableWidget.

Parameters
parentThe parent widget.

Member Function Documentation

◆ append() [1/2]

void LogTableWidget::append ( logging::LogLevel level,
const QString & source,
const QString & file,
const uint32_t line,
const QString & message )

Appends a log message with a QString source and file.

Parameters
levelThe log level.
sourceThe source of the log message.
fileThe file where the log message was generated.
lineThe line number in the file.
messageThe log message.

◆ append() [2/2]

void LogTableWidget::append ( logging::LogLevel level,
const std::string & source,
const std::string & file,
const uint32_t line,
const std::string & message )

Appends a log message with a std::string source and file.

Parameters
levelThe log level.
sourceThe source of the log message.
fileThe file where the log message was generated.
lineThe line number in the file.
messageThe log message.

◆ copySelectedColumn()

void LogTableWidget::copySelectedColumn ( int column) const
private

Copies a specific column of the selected rows to the clipboard.

Parameters
columnThe index of the column to copy.

◆ copySelectedColumns()

void LogTableWidget::copySelectedColumns ( std::initializer_list< int > columns) const
private

Copies multiple columns of the selected rows to the clipboard.

Parameters
columnsA list of column indices to copy.

◆ eventFilter()

bool LogTableWidget::eventFilter ( QObject * watched,
QEvent * event )
private

Filters events for child widgets.

Parameters
watchedThe widget being watched.
eventThe event to filter.
Returns
True if the event should be accepted, false otherwise.

◆ isMessageElided()

bool LogTableWidget::isMessageElided ( int proxyRow) const
private

Checks if a message is elided in the table.

Parameters
proxyRowThe row index in the proxy model.
Returns
True if the message is elided, false otherwise.

◆ onAreaCollapsed

void LogTableWidget::onAreaCollapsed ( ClickableIcon * button,
QLineEdit * lineEdit,
const QString & iconName )
privateslot

Handles area collapse events.

Parameters
buttonThe button that triggered the event.
lineEditThe line edit associated with the button.
iconNameThe icon name for the collapsed state.

◆ onAreaExpanded

void LogTableWidget::onAreaExpanded ( ClickableIcon * button,
QLineEdit * lineEdit )
privateslot

Handles area expansion events.

Parameters
buttonThe button that triggered the event.
lineEditThe line edit associated with the button.

◆ onClicked

void LogTableWidget::onClicked ( const QModelIndex & index)
privateslot

Handles click events on table items.

Parameters
indexThe model index of the clicked item.

◆ selectedRows()

QVector< int > LogTableWidget::selectedRows ( ) const
private

Returns a vector of selected row indices.

Returns
A vector of selected row indices.

◆ setSearchText()

void LogTableWidget::setSearchText ( const QString & text)
private

Sets the search text and updates the search matches.

Parameters
textThe new search text.

◆ showContextMenu()

void LogTableWidget::showContextMenu ( const QPoint & pos)
private

Shows the context menu at the specified position.

Parameters
posThe position where the context menu should be shown.

◆ updateFilterText()

void LogTableWidget::updateFilterText ( QToolButton * button,
const QString & base )
private

Updates the text in a toolbutton filter.

Parameters
buttonThe toolbutton to be updated.
baseThe default text.

The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/widgets/log_table_widget.h
  • /__w/maki/maki/app/widgets/log_table_widget.cpp