PyQT: qt.qApp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Axel Mittendorf

    PyQT: qt.qApp

    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


  • John J. Lee

    #2
    Re: PyQT: qt.qApp

    "Axel Mittendorf" <newsreply@tran sfertech.de> writes:
    [...][color=blue]
    > 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[/color]

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

    [color=blue]
    > and I want them to use my subclass (exactly its instance)
    > instead of 'qApp'. How can I solve this?[/color]

    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.

    [color=blue]
    > Can someone tell me what qt.qApp is and what it is used for?
    > (I'm using PyQT 3.6.)[/color]

    See above.


    John

    Comment

    • Roberto Alsina

      #3
      Re: PyQT: qt.qApp

      "Axel Mittendorf" <newsreply@tran sfertech.de> wrote in message news:<bu3pph$qm a$01$1@news.t-online.com>...[color=blue]
      > 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.)[/color]

      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.setOverrid eCursor

      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

      Comment

      Working...