Hi to all,
in a recent discussion linked here [qt-project.org], i’ve defined a subclass of QTabWidget.
Now I’m defining a method for adding a closable tab, because by using the method setTabsClosable, the button is added to all tabs but I want to create some tab with the button. I’ve defined this method:
void TabWidget::addClosableTab(QString name, QString imagepath){
addTab(new QWidget, name);
QTabBar *tab = tabBar();
QToolButton *tool = new QToolButton();
tool->setIcon(QIcon(imagepath));
tab->setTabButton(QTabWidget::count() -1, QTabBar::RightSide, tool);
}
i’ve defined this connect in the constructor but it doesn’t work with the button defined (if i use setClosableTabs, the connect works):
connect(tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));
↧