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

Property decorator with constant=True generates TypeError

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.15.1, 5.15.2
    • PySide, Shiboken
    • Python 3.8.6
    • Linux/Other display system
    • fbd3ff2256a338a04f08923620216076be64106d (pyside/pyside-setup/dev)

    Description

      PySide2 generates TypeError when use Property decorator with constant=True

      TypeError: A constant property cannot have a WRITE method or a NOTIFY signal.

      To reproduce - prepare the simple class:

      class A(QObject):
          def __init__(self):
              QObject.__init__(self)
              self.val = str("")
      

      when executing python script PySide2 generates TypeError for this code:

      @Property(str, constant=True)
      def variable(self):
           return self.val

      However, when we transform the previous code into this:

      def getVal(self):
          return self.val
      
      variable = Property(str, getVal, constant=True)
      

      It works.

      In PySide 5.15.0 it all works fine but for version 5.15.1 and 5.15.2 the decorator example generates TypeError.

       

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-1426
          # Subject Branch Project Status CR V

          Activity

            People

              ctismer Christian Tismer
              blooser Mateusz Solnica
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes