I have set ui->tabWidget->setTabsClosable(true);
but QTabwidget
only showing a cross on each tab that is not closing tab on click on this button. What else I have to do to make tabs closable? I tried to connect any slot (which would be proper for this work) of close to signal tabCloseRequested(int)
but couldn't find any such slot in tabwidget. Please suggest the right way.
Create a slot e.g. closeMyTab(int)
and connect the tab widget's tabCloseRequested(int)
signal to this slot. In this slot call tab widget's removeTab
method with the index received from the signal.
See this answer for more details.