[PyQt] QtGui.QSessionManager: Syntax
Andreas Pakulat
apaku at gmx.de
Fri Dec 14 11:42:25 GMT 2007
On 14.12.07 20:22:45, 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.
>
> 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 same syntax I guess. PyQt4 is nothing else than Qt4, but with python
syntax rather than C++. So just translate the C++ specific language
things into the Python language equivalent and it'll work. In
particular that page says you should override commitData() and
saveState() not call it.
Andreas
--
Many changes of mind and mood; do not hesitate too long.
More information about the PyQt
mailing list