PDA

View Full Version : AddTab button in QTabBar



ekapek
3rd July 2010, 18:13
Hi,

I need to add simple push or tool button to TabBar like in Opera or Firefox to add new tab I try with setTabButton


QPushButton *m_addButton = new QPushButton("+", this);
m_addButton->setObjectName("addButton");
connect(m_addButton, SIGNAL(clicked()), this, SLOT(newTab()));
QTabBar * tabBar = new QTabBar();
tabBar->setTabButton(0, QTabBar::RightSide, m_addButton);

but this don't work - the button is behind the tabs

How can I do this?

agathiyaa
3rd July 2010, 18:35
Simple solution may be
1. use QTabWidget & setCornerWidget function instead of using QTabBar.
2. If you want to use QTabBar you have to create & draw your control or find the layout used and add your widget next to last item in the layout.

Talei
3rd July 2010, 18:51
If You want to add i.e. pushbutton INSIDE particular tab (not on the tab itself) do:
add herizontal/vertical-layout inside tab, don't
then


ui->verticallayout->addWidget(m_addButton);