Debian Codegraph @

src/librssguard/gui/tabbar.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 #ifndef TABBAR_H
4 #define TABBAR_H
5
6 #include "miscellaneous/iconfactory.h"
7
8 #include <QTabBar>
9 #include <QVariant>
10
11 class TabBar : public QTabBar {
12 Q_OBJECT
13
14 public:
15 enum class TabType {
16 FeedReader = 1,
17 DownloadManager = 2,
18 NonClosable = 4,
19 Closable = 8
20 };
21
22 // Constructors.
23 explicit TabBar(QWidget* parent = nullptr);
24 virtual ~TabBar();
25
26 // Getter/setter for tab type.
27 void setTabType(int index, TabType type);
28 TabBar::TabType tabType(int index) const;
29
30 private slots:
31
32 // Called when user selects to close tab via close button.
33 void closeTabViaButton();
34
35 private:
36 // Reimplementations.
37 void mouseDoubleClickEvent(QMouseEvent* event);
38 void mousePressEvent(QMouseEvent* event);
39 void wheelEvent(QWheelEvent* event);
40
41 signals:
42
43 // Emmited if empty space on tab bar is double clicked.
44 void emptySpaceDoubleClicked();
45 };
46
47 inline TabBar::TabType TabBar::tabType(int index) const {
48 return static_cast<TabBar::TabType>(tabData(index).toInt());
49 }
50
51 TabBar::TabType operator|(TabBar::TabType a, TabBar::TabType b);
52 TabBar::TabType operator&(TabBar::TabType a, TabBar::TabType b);
53 TabBar::TabType& operator|=(TabBar::TabType& a, TabBar::TabType b);
54 TabBar::TabType& operator&=(TabBar::TabType& a, TabBar::TabType b);
55
56 #endif // TABBAR_H