Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Changing QTabBar close button



  • I need to change the size of the tab close button. It seems that doing this by using stylesheets is impossible (at least, I have not found a working solution), so I have tried to change the control via QTabBar::setTabButton method. The new button shows properly, but clicking it does not emit tabCloseRequested singal anymore. Is there a way to change the close button without subclassing QTabWidget and reimplementing the logic of tab closing?


  • Lifetime Qt Champion

    Hi,

    You can use a QMap to link either the tab index or the widget to the button and in a close slot retrieve that to close the corresponding tab.

    Hope it helps


Log in to reply