[PyQt] qgraphicsitem not cleared before paint(...) ?

Mads madsornomads at gmail.com
Sun Jan 3 20:38:57 GMT 2010


Well, I should read the documentation more carefully.... to clarify my
own ramblings:

SetVisible(...) should not be called, but prepareGeometryChange()
should be called *before* changing the bounding rectangle.

/M

On Sun, Jan 3, 2010 at 5:21 PM, Mads <madsornomads at gmail.com> wrote:
> Well, to answer my own question:
>
> calling SelectionMarker.SetVisible(False) when clearing the selection
> and SelectionMarker.SetVisible(True) before painting does the trick.
>
> If anybody has some clarifications as to why this is needed  - please
> feel free to comment.
>
> Best regards,
> Mads
>
> On Sun, Jan 3, 2010 at 12:13 PM, Mads <madsornomads at gmail.com> wrote:
>> Hi,
>>
>> I'm trying to implement a selection marker so the user can see the
>> selected area in a QGraphicsView. The selection is drawed from a
>> mousePressEvent(..) until a mouseReleaseEvent(..). However the
>> QGraphicsItem isn't always cleared before the next selection? Is there
>> a flush() or something else I need to call?
>>
>> I have attached the code. The following link points to an image
>> showing the selections not being cleared:
>> http://img263.imageshack.us/img263/6339/marker.png.
>>
>> Thanks!
>>
>> Best regards,
>> Mads
>>
>


More information about the PyQt mailing list