QGraphicScene and different topmost QGraphicItem
Hi,
I've a slot as follows:
Code:
qDeleteAll( scene.items() );
el
->setBrush
( QBrush(Qt
::green) );
scene.addItem( el );
el1
->setBrush
( QBrush(Qt
::green) );
scene.addItem( el1 );
el2
->setBrush
( QBrush(Qt
::green) );
scene.addItem( el2 );
el3
->setBrush
( QBrush(Qt
::green) );
scene.addItem( el3 );
scene.addLine( 0,-400, 0, 400 );
scene.addLine( -400,0, 400, 0 );
setScene(&scene);
fitInView(scene.itemsBoundingRect());
When I call this slot I have different QGraphicItem at top. Sometimes is a line and sometimes a ellipse ?(
What should I do to have always lines the topmost items?
I hope I clearly explain what is my problem. To be sure here is a PrintScreen, you can see that left ellipse is over the line, but others are below. This is a first call for this slot.
http://fraktal.wmp.uksw.edu.pl/~kamil/a.JPG
Does anybody know what I'm doing wrong?
Re: QGraphicScene and different topmost QGraphicItem
You may use QGraphicsItem::setZValue() to adjust the stacking order of graphics items.
Re: QGraphicScene and different topmost QGraphicItem
Quote:
Originally Posted by
jpn
This is what I was looking for :D
Thaks a lot.
Re: QGraphicScene and different topmost QGraphicItem
You might also want to turn on antialiasing for the view ;) Those ellipses don't look very good.