[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] [BUG] Can't override protected method QSGMaterialShader::compile() in Python
From: Vladimir Rutsky <rutsky.vladimir () gmail ! com>
Date: 2015-06-18 19:18:20
Message-ID: CAMwdcVZgXu3yzeowRp82HVXrd8Y4SHQzV5-RjM71dG5NXwCYEA () mail ! gmail ! com
[Download RAW message or body]
On Tue, Jun 2, 2015 at 4:48 PM, Phil Thompson
<phil@riverbankcomputing.com> wrote:
> On 02/06/2015 1:14 pm, Vladimir Rutsky wrote:
>>
>> On Tue, Jun 2, 2015 at 2:01 PM, Phil Thompson
>> <phil@riverbankcomputing.com> wrote:
>>>
>>> On 02/06/2015 11:50 am, Vladimir Rutsky wrote:
>>>>
>>>>
>>>> Overriden QSGMaterialShader::compile() is never called in Python.
>>>
>>>
>>>
>>> How is the shader being created?
>>>
>>> Phil
>>
>>
>> The shader is created when Qt calls createShader() in my derivative of
>> QSGMaterial:
>>
>> class MyMaterialShader(QSGMaterialShader):
>> ...
>>
>> def initialize(self):
>> # This method and some others are successfully called
>> ...
>>
>> def compile(self):
>> # This code never called
>> print("Test")
>> return super().compile()
>>
>>
>> class MyMaterial(QSGMaterial):
>> _type = QSGMaterialType()
>>
>> def __init__(self):
>> super().__init__()
>>
>> def compare(self, other_material):
>> if self is other_material:
>> return 0
>> else:
>> return -1 if id(self) < id(other_material) else 1
>>
>> def createShader(self):
>> # TODO: PyQt bug with ownage
>> self._shader = MyMaterialShader()
>> return self._shader
>>
>> def type(self):
>> return self._type
>>
>> MyMaterial is used as material for QSGGeometryNode().
>
>
> Can you send me a short, complete script that demonstrates the problem?
>
> Thanks,
> Phil
I was wrong about this issue: overriden QSGMaterialShader::compile()
is properly called from Python.
I missed, that it is required by Qt to set
QSGMaterial.CustomCompileStep flag for used material, so Qt will call
QSGMaterialShader::compile().
Regards,
Vladimir Rutsky
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://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