Re: Inherit from QBufferDataGenerator

Phil Thompson <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
On 17/05/2019 11:12, Maxim Okhotskiy wrote:
> 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

The problem is how to implement workable bindings for QAbstractFunctor. 
I think it's probably possible to do - but I'm not sure it is worth it.

Is there any need to use setDataGenerator() rather than just setData()?

If setData() is adequate then I would probably remove QAbstractFunctor 
and all related sub-classes and methods.

Phil
_______________________________________________
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.