Skip to content

OutputsWidget

class nmeasim::app::OutputsWidget · Applications

Table of the configured outputs with their live status.

Inherits QWidget

Declared in src/app/widgets/outputs_widget.hpp (line 33)

Each row is one io::OutputChannel of the observed runner, in profile order, with the columns Output (the transport description), Status (the state as io::to_string names it, with a light in state_color), Clients, Lines (sentences or state messages handed to the open transport), Bytes and Last error. The table is read-only and refreshes every 500 ms while a runner is attached, when the runner starts or stops or reports an output error, and when the theme changes.

Summary

Public member functions

Name Description
OutputsWidget() Creates an empty table with no runner attached.
set_runner() Observes a runner.
refresh() Rebuilds the rows from the runner's outputs, or empties the table without a runner.
row_count() Returns the number of rows.
status_text() Returns the text of the status column.
status_color() Returns the colour of the status column.

Private data members

Name Description
table_ The table, owned by this widget.
refresh_timer_ Drives the periodic refresh while a runner is attached.
runner_ The observed runner, not owned; null when detached.

Public member functions

OutputsWidget()

explicit OutputsWidget(QWidget* parent = nullptr)

Creates an empty table with no runner attached.

Parameters

Name Type Description
parent QWidget* Parent widget, which owns the panel; may be null, in which case the caller owns it.

Declared in src/app/widgets/outputs_widget.hpp:41 · defined in src/app/widgets/outputs_widget.cpp:73

set_runner()

void set_runner(io::SimulationRunner* runner)

Observes a runner.

Pass nullptr to detach.

Disconnects from the previous runner, connects to the new one's started, stopped and output_error signals, starts or stops the periodic refresh and refreshes at once.

Parameters

Name Type Description
runner io::SimulationRunner* The runner to show; not owned. It must outlive the widget or be detached before it is destroyed. Null empties the table.

Declared in src/app/widgets/outputs_widget.hpp:50 · defined in src/app/widgets/outputs_widget.cpp:95

refresh()

void refresh()

Rebuilds the rows from the runner's outputs, or empties the table without a runner.

Called by the timer and the connected signals; the main window also calls it after applying a profile, which replaces the outputs.

Declared in src/app/widgets/outputs_widget.hpp:55 · defined in src/app/widgets/outputs_widget.cpp:111

row_count()

int row_count() const

Returns the number of rows.

Returns int: One row per output as of the last refresh.

Declared in src/app/widgets/outputs_widget.hpp:60 · defined in src/app/widgets/outputs_widget.cpp:147

status_text()

QString status_text(int row) const

Returns the text of the status column.

Parameters

Name Type Description
row int Row index, from 0.

Returns QString: The state name, such as open or closed; empty when the row does not exist.

Declared in src/app/widgets/outputs_widget.hpp:65 · defined in src/app/widgets/outputs_widget.cpp:156

status_color()

QColor status_color(int row) const

Returns the colour of the status column.

Parameters

Name Type Description
row int Row index, from 0.

Returns QColor: The state_color of the state shown; an invalid QColor when the row does not exist.

Declared in src/app/widgets/outputs_widget.hpp:71 · defined in src/app/widgets/outputs_widget.cpp:151

Private data members

table_

QTableWidget* table_

The table, owned by this widget.

Declared in src/app/widgets/outputs_widget.hpp:75

refresh_timer_

QTimer refresh_timer_

Drives the periodic refresh while a runner is attached.

Declared in src/app/widgets/outputs_widget.hpp:77

runner_

io::SimulationRunner* runner_{nullptr}

The observed runner, not owned; null when detached.

Declared in src/app/widgets/outputs_widget.hpp:79