PyQT: qt.qApp

A

Axel Mittendorf

Hello,
in my application I want to subclass qt.QApplication and
use this subclass instead of QApplication for my gui. Some
of my modules are automatically generated by pyuic and
I am not allowed to change their source code. The problem
is these modules do "from qt import *" and use an object
called 'qApp' which seems to be an instance of qt.QApplication
and I want them to use my subclass (exactly its instance)
instead of 'qApp'. How can I solve this?

Can someone tell me what qt.qApp is and what it is used for?
(I'm using PyQT 3.6.)

TIA,
Axel
 
J

John J. Lee

Axel Mittendorf said:
in my application I want to subclass qt.QApplication and
use this subclass instead of QApplication for my gui. Some
of my modules are automatically generated by pyuic and
I am not allowed to change their source code. The problem
is these modules do "from qt import *" and use an object
called 'qApp' which seems to be an instance of qt.QApplication

IIRC, qApp is *the* QApplication (there's only one QApplication
instance per application).

and I want them to use my subclass (exactly its instance)
instead of 'qApp'. How can I solve this?

I have a vague recollection that you can't, due to an obscure
limitation of either Qt or PyQt (or sip, maybe). That might have
changed by now, though: ask on the PyKDE list.

Can someone tell me what qt.qApp is and what it is used for?
(I'm using PyQT 3.6.)

See above.


John
 
R

Roberto Alsina

Axel Mittendorf said:
Hello,
in my application I want to subclass qt.QApplication and
use this subclass instead of QApplication for my gui. Some
of my modules are automatically generated by pyuic and
I am not allowed to change their source code. The problem
is these modules do "from qt import *" and use an object
called 'qApp' which seems to be an instance of qt.QApplication
and I want them to use my subclass (exactly its instance)
instead of 'qApp'. How can I solve this?

Can someone tell me what qt.qApp is and what it is used for?
(I'm using PyQT 3.6.)

Well, there are some times when you need to call a method of
QApplication.

For example, if you want to put a hourglass cursor for the whole app,
you call
qApp.setOverrideCursor

Anyway, you shouldn´t worry about this. Whatever object you create
that inherits QApplication will be qApp. Since there can only be one
of those, there is no way it´s gonna get confused ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top