pyside / PySide

ATTENTION: This project is deprecated, please refer to PySide2
https://wiki.qt.io/PySide2
GNU Lesser General Public License v2.1
291 stars 66 forks source link

QWidget isMaximized() returns 'true' and 'false' #124

Closed giumas closed 9 years ago

giumas commented 9 years ago

Using PySide 1.2.2, when I try to save the app settings, I noticed that the function in object returns 'true' and 'false' rather than True and False. Is this a bug?

jdreaver commented 9 years ago

Are you sure that this is the case? Here is a test program:

from PySide import QtGui
import sys

app = QtGui.QApplication(sys.argv)

widget = QtGui.QWidget()
widget.show()
print(widget.isMaximized(), type(widget.isMaximized()))

sys.exit(app.exec_())

When I run it, I get the following output:

False <class 'bool'>

However, when you save settings using QSettings, indeed the values are saved as strings. I don't think this is a bug. I think that settings are saved in flat text files in Linux, or in the Windows registry, so there is no notion of a type besides strings (bool, int, etc).

giumas commented 9 years ago

Thank you for taking care of my question. I was working on Win7, and I was using the same approach coded here: https://gist.github.com/bootchk/5330231 but I believe that the part about isMaximized() has some portability issue.

If I change that part to: if q_settings.value("fullScreen", self.isFullScreen()) == 'true':, it works as expected on Windows. Is this portable?

jdreaver commented 9 years ago

I think that's portable. I use a similar approach on Windows and Linux.

Btw, I don't think this is the actual PySide repo. It is just a mirror someone set up. If you encounter bugs in the future, I think there is a more "official" location. It doesn't look like PySide is very actively maintained though :/

giumas commented 9 years ago

Great! Thank you a lot