- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
P3: Somewhat important
 - 
    None
 - 
    6.5.1
 - 
    None
 - 
    Ubuntu Focal, Python 3.10, PySide 6.5.1
 
- 
        
 - 
        16b17fa01 (dev), 8854d73e8 (dev), 20a36aede (dev)
 
According to the documentation here, properties of a QDBusInterface should be accessible through the normal QObject::property() and QObject::setProperty() methods. However, I'm not able to do so.
I've got a DBus object on the session bus with which I'd like to interact. I can see in D-Feet that the interface exposes the property (called "counts") that I expect. However, a small test script is failing to read it. Specifically, this Python script:
session_bus = QDBusConnection.sessionBus()
if not session_bus.isConnected():
    print("Cannot connect to the D-Bus session bus.")
    sys.exit(-1)
iface = QDBusInterface(SERVICE_NAME, '/', INTERFACE_NAME, session_bus)
if not iface.isValid():
    print(session_bus.lastError().message())
    sys.exit(-1)
{{counts_from_remote = iface.property('counts')}}
print(f'Counts from the dbus interface: {counts_from_remote}')
The iface.property('counts') method always returns None, even though the 'counts' property exists on that interface.
I can confirm that the property() method does work correctly for an object that directly inherits QObject:
from PySide6.QtCore import QObject, Property
class MyThing(QObject):
    def _init_(self, parent = None):
        super()._init_(parent)
        self._my_prop = 16
    @Property(int, constant=True)
    def my_prop(self):
        return self._my_prop
def main():
    thing = MyThing()
    p = thing.property('my_prop')
    print(f'The property is {p}')
if _name_ == '_main_':
    main()
It's possible that I'm doing something incorrect here, but it seems like there's at least the possibility that this is a bug.
| For Gerrit Dashboard: PYSIDE-2535 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 520766,11 | shiboken6: Refactor writing the meta object functions | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 | 
| 520767,13 | shiboken6: Add typesystem attribute to suppress the meta object functions | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 | 
| 520768,13 | PySide6: Fix obtaining properties from QDBusInterface | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |