Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Close the correct tab
I have a QTabWidget. When I click the close button on the tab, it emits tabCloseRequested() and calls the following slot:
@void mainView::closeTab(int index)
The slot closes the current tab. For example imagine you have 3 tabs open (labeled 1, 2, and 3). If I am currently on tab 2, and I click the close tab button on tab 3, tab 2 still closes.
I would like the tab with the button clicked to close, regardless of which tab I am on. I believe my problem lies in removing currentIndex(), but I am not sure of a better way to do this.
Thanks for your help!
Why not simply tabWidget->removeTab(index) ?
Do I put anything in for index?
index is the param in your slot. It is passed from the tabCloseRequested signal.
ok it works. Awesome, thanks!