[PyKDE] qApp - myApp relationship

Phil Thompson phil at river-bank.demon.co.uk
Mon Nov 18 17:23:01 GMT 2002


On Monday 18 November 2002 3:40 pm, Michael Lauer wrote:
> Hi, some question concerning the relationship between the qt module
> global qApp attribute and the actual QApplication-derived object which I
> instanciate?
>
> Why is there a qApp object directly after importing the qt module?

Because it is a wrapper for the global qApp pointer. When you create your 
QApplication, qApp gets updated to point to it. In PyQt two different Python 
objects exist - the qApp wrapper and the QApplication wrapper - but they both 
point to the same C++ QApplication instance and can be used interchangeably.

> Is it safe and wise to rebind the qApp with my customized QApplication
> instance?

It is safe but it doesn't buy you anything except the saving of one Python 
object.

Phil




More information about the PyQt mailing list