34 QMap<int, QString> mapName;
35 QMap<int, bool> mapVisible;
36 for(
int i = 0; i <
count; i++)
52 QWidget* widget =
m_stack->widget(index);
54 widget->deleteLater();
87 for(
int i = count - 1; i >= 0; i--)
103 for(
int i =
m_stack->count() - 1; i > 0; i--)
105 QWidget* widget =
m_stack->widget(i);
107 widget->deleteLater();
110 QMap<int, QString> mapName;
111 QMap<int, bool> mapVisible;
126 if(tab < m_stack->
count())
138 QObject* obj = sender();
141 for(
int index = 0; index <
m_tabBar->count(); index++)
143 if(obj ==
m_tabBar->tabButton(index, QTabBar::RightSide))
162 QMap<int, int> mapTabInfo;
164 int numberTabs =
m_mapName.keys().size();
165 for(
int i = 0; i < numberTabs; i++)
178 m_tabBar->setTabButton(count - 1, QTabBar::LeftSide, 0);
181 m_tabBar->setTabButton(0, QTabBar::RightSide, 0);
187 QToolButton* tool =
new QToolButton(
m_tabBar);
189 tool->setObjectName(
"tabBarTool");
190 tool->setFixedSize(16, 16);
191 m_tabBar->setTabButton(count - 1, QTabBar::RightSide, tool);
196 mapTabInfo[currentTab] = i;
201 if(currentTab < count)
203 for(
int i = count - 1; i >= currentTab; i--)
214 for(
int i = 0; i <
m_tabBar->count(); i++)
219 m_tabBar->setCurrentIndex(tabCurrent);
void on_closeButtonClick()
on_closeButtonClick Slot for close button click
void setTabVisible(int index, bool visible)
setTabVisible Set tab visible
void removeTab(int index)
removeTab Removing tab
TabBarInfo(QStackedWidget *parent)
TabBarInfo Constructor.
void attach(QTabBar *tabBar, QIcon *iconCloseTab)
attach Attack the tab bar
bool addTab(int index, const QString &name)
addTab Add new tab
void setCurrent(int index)
setCurrent Set current index
QMap< int, int > m_mapTabInfo
void update()
update Update the GUI
void detach()
detach Detach the tab bar
void clear()
clear Remove all tabs except the first one which is not closable
void on_currentChanged(int index)
on_currentChanged Slot for changing the tab bar index
QMap< int, QString > m_mapName
QMap< int, bool > m_mapVisible