Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1466

QSettings doesn't store boolean

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.4
    • 5.15.2
    • PySide
    • None
    • Linux/X11
    • f784714aea268248d17056320ac67d77c61eebe6 (pyside/pyside-setup/6.0) 9547dc918868470fe00fafe25d74a87b2ed35f1f (pyside/pyside-setup/dev) db4054bfbe6beddf610850b8c025f7259defebc9 (pyside/tqtc-pyside-setup/tqtc/lts-5.15)

    Description

      Reading value from settings return "true" as a string not as a bool.

      Run the following code 2 time ( to store a value ) .

      This is critical. Because bool("false") return True !

       

       

       
      from PySide2.QtWidgets import *
      from PySide2.QtCore import *
      import sys
      
      if __name__ == "__main__":
      app = QApplication(sys.argv)
       app.setOrganizationName("labsquare")
      settings = QSettings()
      print(type(settings.value("check")))  # ===> bool
      settings.setValue("check", True)
      print(type(settings.value("check"))) # ==> str 
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            sschutz sacha schutz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes