[PyKDE] noob: QtabWidget
apaku at gmx.de
Tue Feb 21 19:56:50 GMT 2006
On 21.02.06 20:16:49, Tina Isaksen wrote:
> I'm still having some problems understanding the QT-assistant it seems.
To me it seems you have some problems translating the C++-docs to Python
> I have a tab widget and need to check what tab is the active one, so I have
> tried (among other things):
What exactly does that mean?
> def doSaveMain(self):
> if self.isTabEnabled(self.mainTabWidget * sources):
This would call isTabEnabled on "self" which doesn't seems to be the
QTabWidget. Thats the first problem, now the second is: You try to
multiply the QTabWidget with the value of the variable sources.
> "mainTabWidget" is of course my Qtab widget and "source" is the name of the
So you want to check wether the widget with the label "source" is
enabled? You could do:
if self.mainTabWidget.label(self.mainTabWidget.currentPageIndex()) == "source":
do whatever you want.
> self.mainTabWidget = QTabWidget(self.centralWidget(),"mainTabWidget")
> self.sources = QWidget(self.mainTabWidget,"sources")
If self.sources points to the widget it's even easier:
if self.mainTabWidget.currentPage() == self.sources:
The Qt docs are for C++, there "QWidget* w" means: The variable "w" has
the type "pointer to QWidget". So the isTabEnabled function wants a
QWidget instance as parameter and as it belongs to QTabWidget needs to
be called on a QTabWidget instance (your mainTabWidget).
Give thought to your reputation. Consider changing name and moving to
a new town.
More information about the PyQt