[PyQt] QApplication.saveStateRequest does not work well with PyQt 4.8

Phil Thompson phil at riverbankcomputing.com
Fri May 20 17:14:59 BST 2011


On Fri, 20 May 2011 14:45:35 +0200, Wilbert Berendsen <wbsoft at xs4all.nl>
wrote:
> Hi,
> 
> In my application ("frescobaldi") (using API 2 for QString and
QVariant),
> if qApp is an QApplication(),
> 
> def saveState(sm):
>     pass # code saving state
> 
> qApp.saveStateRequest.connect(saveState)
> 
> yields:
> 
> Object::connect: No such signal
> QApplication::saveStateRequest(QSessionManager)
> Object::connect:  (sender name:   'frescobaldi')
> Traceback (most recent call last):
>   File "./frescobaldi", line 2, in <module>
>     import frescobaldi_app.main
>   File "/home/fede/src/frescobaldi/frescobaldi_app/main.py", line 41, in
> <module>
>     import session          # Initialize QSessionManager support
>   File "/home/fede/src/frescobaldi/frescobaldi_app/session.py", line
> 100, in <module>
>     app.qApp.saveStateRequest.connect(saveState)
> TypeError: connect() failed between saveStateRequest(QSessionManager)
> and unislot()
> 
> So, first QApplication complains, and then PyQt4 errors out.
> 
> On PyQt 4.7 this works well.
> 
> On PyQt4.8 the old way of connecting does work, however:
> 
> QObject.connect(qApp, SIGNAL("saveStateRequest(QSessionManager&)"),
> saveState)
> 
> does work correctly on both PyQt versions (4.7 and 4.8).
> 
> Is this intended?

It's a SIP code generation bug. It's fixed in hg and tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list