ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
tab_indicator.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
12
13#ifndef STREAMS_TAB_INDICATOR_H
14#define STREAMS_TAB_INDICATOR_H
15
16#include <functional>
17
18#include <QLabel>
19#include <QObject>
20#include <QTabWidget>
21#include <QTimer>
22#include <QWidget>
23
30class TabIndicator : public QObject
31{
32 Q_OBJECT
33
34public:
43 explicit TabIndicator(QTabWidget *tabs, QWidget *page, const QString &tooltip,
44 QObject *parent = nullptr);
45
46 ~TabIndicator() final = default;
47
48 TabIndicator(const TabIndicator &) = delete;
49 TabIndicator &operator=(const TabIndicator &) = delete;
50 TabIndicator(TabIndicator &&) = delete;
51 TabIndicator &operator=(TabIndicator &&) = delete;
52
58 void setActive(bool active);
59
66 void poll(std::function<bool()> running, int interval_ms = 500);
67
68private:
70 QLabel *m_dot = nullptr;
72 QTimer m_timer;
74 std::function<bool()> m_running;
75};
76
77#endif // STREAMS_TAB_INDICATOR_H
std::function< bool()> m_running
The polled predicate.
Definition tab_indicator.h:74
void setActive(bool active)
Show or hide the dot.
Definition tab_indicator.cpp:34
TabIndicator(QTabWidget *tabs, QWidget *page, const QString &tooltip, QObject *parent=nullptr)
Add a hidden red dot to the header of a tab.
Definition tab_indicator.cpp:19
QTimer m_timer
Polling timer.
Definition tab_indicator.h:72
void poll(std::function< bool()> running, int interval_ms=500)
Follow a predicate, evaluated on the GUI thread at a fixed interval.
Definition tab_indicator.cpp:41
QLabel * m_dot
The dot, owned by the tab bar.
Definition tab_indicator.h:70