python - How do I subclass QApplication properly? -
i newbie pyqt4 (and qt altogether), , facing problem,
i have subclassed qapplication (to have global data , functions global application):
class app(qapplication): def __init__(self): qapplication.__init__(self) self.foo = none def bar(self,x): do_something()
when try add slot main window like:
self.connect(bar, signal('triggered()'), qapp.bar)
i error: attributeerror: bar
what doing wrong? or should make stuff want global, global stuff
instead off attributes , methods of qapplication subclass? (or else, if so, what?)
note: worked fine when "global" methods , attributes in qmainwindow -subclass...
try adding qtgui.qapp = self
__init__
method (or try using qapplication.instance()
instead of qapp
).
i hope helps.
Comments
Post a Comment