[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Inherit from QBufferDataGenerator
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2019-05-22 16:25:42
Message-ID: f3cacee6b0fed1edf28e1a5e293c2629 () riverbankcomputing ! com
[Download RAW message or body]

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    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic