[PyQt] QGraphicsItem missing method

Phil Thompson phil at riverbankcomputing.com
Sat Apr 17 19:44:40 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


More information about the PyQt mailing list