PDA

View Full Version : tabWidget tabs closebutton always closes the current tab



qt_gotcha
9th August 2010, 12:05
Hi,
I have a tabWidget with tabs that have red close buttons. If I hover with my mouse over the non current tabs they highlight and I can press the red close button. However, instead of closing the tab that is highlighted, the current tab is closed.
Is that normal ? How can I prevent this?
thanx

tsp
9th August 2010, 16:09
Can you show your method to where tabCloseRequested (http://doc.trolltech.com/latest/qtabwidget.html#tabCloseRequested) signal is connected? Maybe you are removing (http://doc.trolltech.com/latest/qtabwidget.html#removeTab) current tab instead of the one that is requested i.e. to where the index points to?

qt_gotcha
9th August 2010, 16:35
there was the problem, I ignored the 'int' in

connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
thanks