
Originally Posted by
Rhayader
You can close close the tab by connecting the tabCloseRequested ( int index ) signal to a slot like
connect(tabWidget, SIGNAL(tabCloseRequested ( int )), this, slot(closeTab(int))).
I am not sure if you read that I had been trying to do that. I am using PyQt also, so there is going to be a difference in syntax.
When I try
self.connect(self.chatView, QtCore.SIGNAL('QtGui.QTabWidget.tabCloseRequested(int)'), self, QtCore.SLOT('closeTab(int)'))
self.connect(self.chatView, QtCore.SIGNAL('QtGui.QTabWidget.tabCloseRequested(int)'), self, QtCore.SLOT('closeTab(int)'))
To copy to clipboard, switch view to plain text mode
I am told that the slot does not exist.
When I try
self.connect(self.chatView, QtCore.SIGNAL('QtGui.QTabWidget.tabCloseRequested(int)'), self, QtCore.SLOT(self.closeTab))
self.connect(self.chatView, QtCore.SIGNAL('QtGui.QTabWidget.tabCloseRequested(int)'), self, QtCore.SLOT(self.closeTab))
To copy to clipboard, switch view to plain text mode
I am told that the slot argument is an instance method. And if I place the parenthesis behind it, (int), Python will try and call the instance right away.
When I try
self.connect(self, QtCore.SIGNAL('tabCloseRequested(index)'), self.closeTab)
self.connect(self, QtCore.SIGNAL('tabCloseRequested(index)'), self.closeTab)
To copy to clipboard, switch view to plain text mode
or
self.connect(self.chatView, QtCore.SIGNAL('tabCloseRequested(index)'), self.closeTab)
self.connect(self.chatView, QtCore.SIGNAL('tabCloseRequested(index)'), self.closeTab)
To copy to clipboard, switch view to plain text mode
nothing happens.
Bookmarks