[PyKDE] Peculiar canvas behavior

Phil Thompson phil at river-bank.demon.co.uk
Fri Mar 22 19:28:07 GMT 2002

greg landrum wrote:
> [System details: RH linux 7.1 kernel 2.4.2-2smp, g++ 3.0.3, Python
> 2.1.1, Qt 3.0.2, PyQT/Sip-3.1rc2]
> I'm experiencing some oddness in the way the QCanvas behaves.
> The attached script creates a QCanvas and QCanvasView and puts a couple
> boxes on the canvas.  The boxes can be deleted by selecting them (left
> click) and hitting delete.  Easy enough.
> Well... kind of.
> There's an if block down around line 82 in the keyboard event handler.
> When that's if 0 (the current state), the deletion code is in the
> method.  When this executes, the highlight around the selected box is
> removed but the box itself remains on the canvas until another event is
> processed.
> If I put the exact same deletion code in a separate method and call it
> there (when line 82 is if 1), the box is immediately deleted.
> This has me completely mystified and makes me think something else is
> badly wrong in my code.  Is the behavior at least reproducible on other
> systems?

It's reproducible on SIP/PyQt 3.1, Qt 3.0.3 and Python 2.2 - but I'm
none the wiser.

It's like a re-draw problem. If you press Del, then don't generate
another event but partially overlay the "deleted" box with another
window, then move the window away, then the overlaid part is re-drawn


More information about the PyQt mailing list