[PyKDE] how to identify empty space on a qcanvas

Solly Brown sollyb at cse.unsw.edu.au
Fri May 27 03:57:15 BST 2005


I've got a qcanvas with a number of canvasitems moving about on it. I need 
to efficiently identify which areas of the canvas are empty (ie. don't 
have any objects on them).

The simplest implementation is to lay down a grid of qpoints on the 
canvas, and then just check whether there are collisions with each point 
-- if there are no collisions then that particular point area is empty.

The problem with this is that it's really slow... a 40x40 grid has 1600 
points and looping through all of them and calling 'collisions' on each 
one makes my display slow to a crawl.

Can anyone suggest an efficient way of identifying which points on a grid 
are clear (don't have collisions above them)?

Thanks for your help....!

Solly




More information about the PyQt mailing list