Hi,
I'm currently trying to modify an existing PyQt app so that it stores
the windowState of its main window when it exits. The information is
retrieved with the QWidget::windowState method, and restored with the
QWidget::setWindowState method. The state itself it an object of type
WindowStates, which is a QFlags.
When trying to save it with QSettings::setValue, I get the following
errors. When I try:
settings.setValue("windowstate", self.windowState())
I get:
TypeError: argument 2 of QSettings.setValue() has an invalid type
When I try:
settings.setValue("windowstate", QtCore.QVariant(self.windowState()))
I get:
QVariant::save: unable to save type 262.
Finally I realized there is a __int__ method in the WindowStates
object, which I guess is mapped to the C++ "operator int" method.
However, while I can save that value, I cannot rebuild the
WindowStates object from an int. There is no constructor taking an int
as parameter in QFlags.
So what is the correct way to save and restore a windowState ?
Note that I'm a noob at both Qt and Python.
Jérôme.
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt