- list will be converted to QVariantList, and it is very SLOW. Only use it for small array.
- Use QByteArray to pass very large array. Take care if you don't want any copies occuring
- QByteArray will be converted to ArrayBuffer
- Use Float32Array(bytearray) to wrap the array without copy
- Use Float32Array.buffer prop to retrieve ArrayBuffer used by Float32Array
Note that some operations will make its new copy of buffer. ex. slice()
Buffer is stored in row-major
class Buffer(QObject):
# emit update when your data has changed
update = Signal()
@Property(int)
def channels(self):
return 1
@Property(int)
def length(self):
return 1
# readonly property for QML
@Property(QByteArray)
def array(self):
# self._arr.shape must be [?, length]
# because Float32Array don't have 'stride' parameter
# https://github.com/tc39/proposal-typedarray-stride
return QByteArray(self._arr.tobytes())
Plugin directory includes highly reusable QML and Python extension modules or libraries. It's recommand to make plugin if your modules has potential to be used in other project. Usually, plugins have no other dependency.
For example plugin project, see hcmusic.audio. A valid python plugin must contains __init__.py
. If you wish to export extension module for QML, you must declare qmlexports variable, and it will be directly forwarded to qmlRegisterType.
qmlexports = [
{'class': AudioInputDevice, 'exportName': 'AudioInputDevice', 'uri': 'hcmusic.audio', 'major': 1, 'minor' : 0}
]
Contains highly reusable module for this project.
Highly specialized component, usually based on App module.