[PyKDE] Problems with a port of C++/Qt book to Python

mbouchar mbouchar at bioinfo.ulaval.ca
Mon Jul 18 16:10:04 BST 2005


Douglas Soares de Andrade wrote:

>Hi !
>
>Another problem:
>
>What about this construction ?
>
>class FindDialog :  public QDialog
>{
>	Q_OBJECT
>	
>	public:
>		FindDialog(QWidget *parent, const char *name = 0);
>
>All is clear for me, but what about the Q_OBJECT macro ? How to use it in 
>PyQt ?
>
>  
>
Just remove it. This macro is used to tell qmake to use moc (trolltech 
preprocessor) for the specified class.

>Another thing... 
>
>How to use the tr() function ? 
>  
>
I really don't know. pyuic seems to create his own wrapper for 
translation with :
    def __tr(self,s,c = None):
        return qApp.translate("FGenOptionsBase",s,c)
in each class

>How to use this setCaption() in the code below, do i have to use self, or 
>QDialog ? 
>  
>
self.setCaption() or QDialog.setCaption(self) are the same, except if 
you subclassed setCaption.

I recomment using self.setCaption()

>And, in the connect line, what to do with the this keyword ?
>
>  
>
You replace this with self.




More information about the PyQt mailing list