[PyKDE] noob: QtabWidget

Tina Isaksen tina at bestemselv.com
Wed Feb 22 05:05:03 GMT 2006


Andreas Pakulat wrote:

>To me it seems you have some problems translating the C++-docs to Python
>;-)
>  
>
Very much so! I know next to nothing about C++

>  
>
>>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?
>  
>
I have a QtabWidget with three pages (tabs) and needs to check what page 
is the active one.

>  
>
>>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. 
>  
>
Heh... trying with the '*' was a last desperate attempt because I could 
not understand why one would need to multiply.

>
>If self.sources points to the widget it's even easier:
>
>if self.mainTabWidget.currentPage() == self.sources:
>  
>
Thanks! Worked like a charm.  And what's even better; after looking it 
up in the assistant I actually understand it ;)

>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).
>  
>
Thanks for the explanation. I'm having a hard time catching the C++ to 
Python 'conversion' so this really helps. I really apreciate it.

Tina





More information about the PyQt mailing list