[PyQt] Inherit from QBufferDataGenerator

Maxim Okhotskiy m.okhotskiy at gmail.com
Fri May 17 11:12:12 BST 2019


Hi, I have a difficulty with inheriting from QBufferDataGenerator:
I use python3 and

PyQt5>=5.12
pyqt3d>=5.12
pyopengl

Here's an example.py

from PyQt5.QtCore import *from PyQt5.Qt3DCore import *from
PyQt5.Qt3DRender import *
class SomeDataGenerator(QBufferDataGenerator):
    def __init__(self, some_bytes):
        super().__init__()
        self._bytes = some_bytes

    def __call__(self):
        return self._bytes

    def __eq__(self, other):
        return (self._bytes == other._bytes)

    def __neq__(self, other):
        return not (self._bytes == other._bytes)

    def id(self):
        return functorTypeId(SomeDataGenerator)


someBytes = QByteArray()
someBuffer = QBuffer(QBuffer.VertexBuffer)
someDataGenerator = SomeDataGenerator(someBytes)
someBuffer.setDataGenerator(someDataGenerator)

Run provides the following result:

$ python3 example.py...TypeError:
PyQt5.Qt3DRender.QBufferDataGenerator cannot be instantiated or
sub-classed

-- 
Best regards,
Maxim Okhotskiy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190517/898984a6/attachment-0001.html>


More information about the PyQt mailing list