On Mié 29 Sep 2010 00:41:56 go canal escribió:
> Hi,
> a newbie question and sorry if it was asked before, I googled it but have
> not find good answer:
>
> I have a tab widget, a few tabs, each tab has a close button. When I
> clicked the close button, I want to remove the tab. Question is, how do I
> know which button is clicked in the connection:
>
> public class MyTab extends QTabWidget {
> ......
>
> private void addTab () {
> QPushButton deleteButton = new QPushButton("x");
> deleteButton.setMaximumWidth(30);
> tabBar.insertTab (1, "New Page");
> tabBar.setTabButton(1, ButtonPosition.RightSide, deleteButton);
> deleteButton.clicked.connect(this, "deleteTab()");
> }
> private void deleteTab () {
> // how do we know which button is clicked, and which tab I should remove ?
> }
>
Hello.
You have two options. One if to use the signalSender method to obtaind the
object that emit the signal that triggers the slot. Two is to use the
QSignalMapper class to map the all the signal y one slot.
>
>
> }
> thanks,
> canal
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest