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

Wilbert Berendsen wbsoft at xs4all.nl
Fri May 20 13:45:35 BST 2011


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?

with many regards,
Wilbert Berendsen

-- 
http://www.wilbertberendsen.nl/
"You must be the change you wish to see in the world."
        -- Mahatma Gandhi


More information about the PyQt mailing list