KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
tabbar.h
1#ifndef TABBAR_H
2#define TABBAR_H
3
4#include <Kanoop/gui/libkanoopgui.h>
5#include <QTabBar>
6
7/**
8 * @brief QTabBar subclass that emits a context-menu signal for individual tab indices.
9 *
10 * TabBar intercepts right-click events and emits tabCustomContextMenuRequested()
11 * with the index of the tab under the cursor, allowing callers to show a
12 * per-tab context menu without subclassing further.
13 */
14class LIBKANOOPGUI_EXPORT TabBar : public QTabBar
15{
16 Q_OBJECT
17public:
18 /**
19 * @brief Construct with an optional parent.
20 * @param parent Optional QWidget parent
21 */
22 explicit TabBar(QWidget *parent = nullptr);
23
24protected:
25 /** @brief Intercept right-click presses to emit the context-menu signal. */
26 virtual void mousePressEvent(QMouseEvent* event) override;
27
28signals:
29 /**
30 * @brief Emitted when the user right-clicks a tab.
31 * @param index Logical index of the tab that was right-clicked
32 */
34};
35
36#endif // TABBAR_H
QTabBar subclass that emits a context-menu signal for individual tab indices.
Definition tabbar.h:15
void tabCustomContextMenuRequested(int index)
Emitted when the user right-clicks a tab.
TabBar(QWidget *parent=nullptr)
Construct with an optional parent.
virtual void mousePressEvent(QMouseEvent *event) override
Intercept right-click presses to emit the context-menu signal.