[PyQt] QtGui.QSessionManager: Syntax

Phil Thompson phil at riverbankcomputing.co.uk
Fri Dec 14 10:48:32 GMT 2007


On Friday 14 December 2007, Chris Giles wrote:
> > > I want to use "QSessionManager" in my PyQt4 application, so that it
> > > will
> >
> > be
> >
> > > reloaded when the user logs back into KDE.  I've tried all of the
> >
> > following
> >
> > > without success.
> > >
> > >    - QtGui.QApplication.saveState ( QtGui.QSessionManager() )
> > >    - aMain.saveState( QtGui.QSessionManager() )
> > >    - smCurrent = QtGui.QSessionManager()
> > >
> > > The error message I receive in each case is as follows.
> > >
> > >    - TypeError: QtGui.QSessionManager cannot be instantiated or
> > >    sub-classed
> > >
> > > I searched on the web for this but found nothing of much use.  Can
> >
> > someone
> >
> > > please explain how to use "QSessionManager" from within a PyQt4
> > > application?
> >
> > http://doc.trolltech.com/4.3/session.html
>
> Thanks, that tells me how to do it in Qt4.  What I also need is for someone
> to explain how to do it in PyQt4, since "QSessionManager cannot be
> instantiated or sub-classed", as noted above.

Exactly the same way.

> At some stage, it's looking like I'll need to use "QSessionManager" and
> none of the above methods work in PyQt4.  I'm hoping someone can supply me
> with syntax that will work in PyQt4, rather than Qt4.

The above wouldn't work using C++ either. Nowhere does the documentation say 
that you should create your own QSessionManager instance.

> If I'm missing the point here, feel free to slap me around with a frozen
> trout or preferred substitutionary implement :-).

Consider yourself slapped ;)

Phil


More information about the PyQt mailing list