PDA

View Full Version : Q3CanvasView Definition



Kapil
9th May 2006, 10:51
Hi,

I read thru the doc of Q3Canvas and Q3CanvasView...
I have a small doubt...
The doc says that a canvas can have multiple views...

Does this mean that when i create a canvas and create 100 rectangles on it,
Both the views will show me the 100 rectangles but the first view would colour the first 50 rectangles in red and the next view would color it in blue..

Is this possible doing on canvas and is the solution the way i have understood or is done in a different manner....

Thanking you a lot..

with regards,
Kapil

wysota
9th May 2006, 11:05
No, because the colour of the item is stored in the item itself and not in its view. Having different views means that they can show different regions of the canvas, with different scales. Of course you could reimplement QCanvasView in that way that it is the object which decides about the colour of the items, but it's not provided out-of-the-box.

Kapil
9th May 2006, 11:13
No, because the colour of the item is stored in the item itself and not in its view. Having different views means that they can show different regions of the canvas, with different scales. Of course you could reimplement QCanvasView in that way that it is the object which decides about the colour of the items, but it's not provided out-of-the-box.

UhOhhhhhhhhh...

The problem which i am facing is that, on my canvas i have created lot many items statically..
Now when i click on Button 1, these independent objects are joined with the dynamically created lines...
On my Button 2 click different sets of items get connected and the previous set of lines are removed...
Now the problem is that when i click on Button 1 my things work fine..
When i click on Button 2, the lines which were created by Button 1 are not removed.. how do i remove those lines from my canvas.. It is something like erasing them out of my canvas... And they are recreated when i click Button 1 again..
How do i do that... i am not able to remove the created lines..

I thought of setting them visible(false) but then for that i would have to keep the track of all the lines that are created which i am not able to 'coz its on user if he wants to create 100 new lines or 150... so am not able to create the line array with a specified number also..
What should i do in this situation....

Plz help me in getting a solution to the problem..

Thanking you..
with regards..
Kapil

wysota
9th May 2006, 11:17
Use QList<Q3CanvasItem*> to store them.

Kapil
9th May 2006, 12:00
Hi..

Thanks a lot..
It worked out using QList...


with regards,
Kapil