PyQT: qt.qApp

Discussion in 'Python' started by Axel Mittendorf, Jan 14, 2004.

  1. 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
     
    Axel Mittendorf, Jan 14, 2004
    #1
    1. Advertising

  2. Axel Mittendorf

    John J. Lee Guest

    "Axel Mittendorf" <> writes:
    [...]
    > 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
     
    John J. Lee, Jan 15, 2004
    #2
    1. Advertising

  3. "Axel Mittendorf" <> wrote in message news:<bu3pph$qma$01$-online.com>...
    > 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 ;-)

    --
    Roberto Alsina
     
    Roberto Alsina, Jan 15, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MK

    Re: PyQT and Mandrake 9.1

    MK, Jul 1, 2003, in forum: Python
    Replies:
    5
    Views:
    313
    Jim Richardson
    Jul 3, 2003
  2. djw

    PyQt and async I/O

    djw, Jul 1, 2003, in forum: Python
    Replies:
    1
    Views:
    594
    Andrew Bennetts
    Jul 2, 2003
  3. Phil Thompson

    ANN: PyQt v3.7 Released

    Phil Thompson, Jul 5, 2003, in forum: Python
    Replies:
    0
    Views:
    322
    Phil Thompson
    Jul 5, 2003
  4. Sybren Stuvel
    Replies:
    12
    Views:
    728
    Sybren Stuvel
    Jul 16, 2003
  5. ulysses
    Replies:
    4
    Views:
    786
    Werner Schiendl
    Oct 22, 2003
Loading...

Share This Page