pyqtProperty type error (second try)

"[email protected]" <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hello list,

I am porting qt5/qtconnectivity/examples/lowenergyscanner to pyqt5.
Bluetooth low energy devices are seached (main.qml) and after selecting a device services are searched (Services.qml).

The port can be found in github <https://github.com/SietseAchterop/BLE_pyqt5> in main.py and the assets directory.

After selecting a device I get the error:
   TypeError: unable to convert a Python 'list' object to a C++ 'QVariant' instance

It seems to be connected with the property
   servicesList = pyqtProperty(QVariant, getServices, notify=servicesUpdated)

The command itself seems ok, but I think this because if I change QVariant to list, the error becomes:
   TypeError: unable to convert a Python 'list' object to a C++ 'QVariantlist' instance

The property is used in Services.qml which is loaded with the loader from main.qml.
The error occurs when the switch is made to Services.qml as far as I can tell.
It still occurs when Services is simplified to:

import QtQuick 2.12
Rectangle {
     width: 300
     height: 600
     ListView {
         id: servicesview
         width: parent.width
         anchors.top: header.bottom
         anchors.bottom: menu.top
         model: device.servicesList
         clip: true

         delegate: Rectangle {
             id: servicebox
             height:100
             width: parent.width
         }
     }
}

Setting the property is ok, but somehow using it in Services.qml gets me the error.
Maybe something to do with the loading?
Note that exactly the same construct is used with searching devices with:
    devicesList = pyqtProperty(QVariant, getDevices, notify=devicesUpdated)
that is used in the ListView in main.qml. And there is no loading there.

   Thanks in advance,
        Sietse
_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.