[PyQt] QGraphicsItem missing method

buddy+pyqt at nmt.edu buddy+pyqt at nmt.edu
Sun Apr 18 03:02:50 BST 2010


> On Sat, 17 Apr 2010 12:27:51 -0600 (MDT), buddy+pyqt at nmt.edu wrote:
>> I recently updated from 4.7 to 4.7.3 and suddenly the QGraphicsItem class
>> no longer
>> seems to have a setOpacity method.  The documentation still indicated
> that
>> should be
>> a valid method.  In addition I noticed that the
> ItemUsesExtendedStyleOption
>> attribute is also missing from the QGraphicsItem class.
>>
>> Attached is some test code I have featuring has a class called CustomItem
>> which
>> inherits from QGraphicsItem and attempts to call setOpacity in it's
>> constructor.
>> When I run it I get the following errror:
>>
>> Traceback (most recent call last):
>>   File "./test.py", line 63, in <module>
>>     item=CustomItem(None,None)
>>   File "./test.py", line 13, in __init__
>>     self.setOpacity(.9)
>> AttributeError: 'CustomItem' object has no attribute 'setOpacity'
>>
>> Please let me know if I somehow have a bad installation or if there's
>> something I
>> can do to fix this.
>
> Works fine for me.
>
> Make sure you aren't using an older version of Qt.
>
> Phil
>

I was using Qt 4.6.0.  I'll upgrade to the 4.7.0 preview, reinstall PyQt 4.7.3 and
try again.

-BB



More information about the PyQt mailing list