PeriDyno 1.0.0
Loading...
Searching...
No Matches
TabToolbar.h
Go to the documentation of this file.
1/*
2 TabToolbar - a small utility library for Qt, providing tabbed toolbars
3 Copyright (C) 2018 Oleksii Sierov
4
5 TabToolbar is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 TabToolbar is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TabToolbar. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TAB_TOOLBAR_H
19#define TAB_TOOLBAR_H
20#include <QTabWidget>
21#include <QToolBar>
22#include <QList>
23#include <QTimer>
24#include <memory>
25
26#include "API.h"
27
28class QToolButton;
29class QFrame;
30class QMenu;
31
32namespace tt
33{
34class Page;
35class StyleParams;
36
37class TT_API TabToolbar : public QToolBar
38{
39 Q_OBJECT
40public:
41 explicit TabToolbar(QWidget* parent = nullptr, unsigned _groupMaxHeight = 75, unsigned _groupRowCount = 3);
42 virtual ~TabToolbar();
43
44 void SetSpecialTabEnabled(bool enabled);
45 Page* AddPage(const QString& pageName);
46 Page* AddPage(const QIcon& icon, const QString &pageName);
47 QAction* HideAction();
48 void AddCornerAction(QAction* action);
49 void SetStyle(const QString& styleName);
50 QString GetStyle() const;
51 unsigned RowCount() const;
52 unsigned GroupMaxHeight() const;
53 int CurrentTab() const;
54 void SetCurrentTab(int index);
55
56signals:
57 void Minimized();
58 void Maximized();
61
62private slots:
63 void FocusChanged(QWidget* old, QWidget* now);
64 void TabClicked(int index);
65 void CurrentTabChanged(int index);
66 void HideAt(int index = -1);
67 void HideTab(int index);
68 void ShowTab(int index);
69
70protected:
71 bool event(QEvent* event) override;
72
73private:
74 void AdjustVerticalSize(unsigned vSize);
75
76 const unsigned groupRowCount;
77 const unsigned groupMaxHeight;
78 bool hasSpecialTab = false;
79 int currentIndex = 0;
80 unsigned maxHeight = QWIDGETSIZE_MAX;
81 QFrame* cornerActions = nullptr;
82 QAction* hideAction = nullptr;
83 QToolButton* hideButton = nullptr;
84 QAction* tabBarHandle = nullptr;
85 QTabWidget* tabBar = nullptr;
86 bool ignoreStyleEvent = false;
87 bool isMinimized = false;
88 bool isShown = true;
90 std::unique_ptr<StyleParams> style;
91
92 friend class Page;
93};
94
95TabToolbar* _FindTabToolbarParent(QWidget& startingWidget);
96
97}
98#endif
void SetStyle(const QString &styleName)
TabToolbar(QWidget *parent=nullptr, unsigned _groupMaxHeight=75, unsigned _groupRowCount=3)
QAction * tabBarHandle
Definition TabToolbar.h:84
QTimer tempShowTimer
Definition TabToolbar.h:89
QAction * HideAction()
unsigned GroupMaxHeight() const
const unsigned groupMaxHeight
Definition TabToolbar.h:77
void ShowTab(int index)
const unsigned groupRowCount
Definition TabToolbar.h:76
void HideTab(int index)
void TabClicked(int index)
void CurrentTabChanged(int index)
QTabWidget * tabBar
Definition TabToolbar.h:85
void SetCurrentTab(int index)
void HideAt(int index=-1)
friend class Page
Definition TabToolbar.h:92
void StyleChanged()
bool event(QEvent *event) override
void SetSpecialTabEnabled(bool enabled)
unsigned maxHeight
Definition TabToolbar.h:80
int CurrentTab() const
Page * AddPage(const QString &pageName)
QToolButton * hideButton
Definition TabToolbar.h:83
void FocusChanged(QWidget *old, QWidget *now)
QString GetStyle() const
unsigned RowCount() const
QAction * hideAction
Definition TabToolbar.h:82
QFrame * cornerActions
Definition TabToolbar.h:81
void SpecialTabClicked()
std::unique_ptr< StyleParams > style
Definition TabToolbar.h:90
void AdjustVerticalSize(unsigned vSize)
bool ignoreStyleEvent
Definition TabToolbar.h:86
void AddCornerAction(QAction *action)
Definition Builder.h:33
TabToolbar * _FindTabToolbarParent(QWidget &startingWidget)