ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
TabIndicator Class Reference

Shows a red dot on the right of a tab header while something is running. More...

#include <tab_indicator.h>

Inheritance diagram for TabIndicator:
Inheritance graph
Collaboration diagram for TabIndicator:
Collaboration graph

Public Member Functions

 TabIndicator (QTabWidget *tabs, QWidget *page, const QString &tooltip, QObject *parent=nullptr)
 Add a hidden red dot to the header of a tab.
 TabIndicator (const TabIndicator &)=delete
TabIndicator & operator= (const TabIndicator &)=delete
 TabIndicator (TabIndicator &&)=delete
TabIndicator & operator= (TabIndicator &&)=delete
void setActive (bool active)
 Show or hide the dot.
void poll (std::function< bool()> running, int interval_ms=500)
 Follow a predicate, evaluated on the GUI thread at a fixed interval.

Private Attributes

QLabel * m_dot = nullptr
 The dot, owned by the tab bar.
QTimer m_timer
 Polling timer.
std::function< bool()> m_running
 The polled predicate.

Detailed Description

Shows a red dot on the right of a tab header while something is running.

The dot is either set directly with setActive(), or follows a predicate that is polled with poll().

Constructor & Destructor Documentation

◆ TabIndicator()

TabIndicator::TabIndicator ( QTabWidget * tabs,
QWidget * page,
const QString & tooltip,
QObject * parent = nullptr )
explicit

Add a hidden red dot to the header of a tab.

Parameters
tabsthe tab widget holding the page
pagethe page whose header gets the dot
tooltipthe tooltip of the dot
parentthe parent object

Member Function Documentation

◆ poll()

void TabIndicator::poll ( std::function< bool()> running,
int interval_ms = 500 )

Follow a predicate, evaluated on the GUI thread at a fixed interval.

Parameters
runningreturns true while the dot should be shown
interval_msthe polling interval in milliseconds

◆ setActive()

void TabIndicator::setActive ( bool active)

Show or hide the dot.

Parameters
activetrue to show the dot

The documentation for this class was generated from the following files: