Re: QGraphicsView Problem !!
Each time your slot is called, you're creating a new ellipse. Instead, you will want to change the size of an existing item, then call update() to repaint it.
Re: QGraphicsView Problem !!
Actually i used update function, but nothing happened !!
here is the Slot with updated function.
Code:
GVar= (int)(ui.horizontalSlider->value());
MySlot::scene.addEllipse (10, 10, GVar, GVar,
QPen(Qt
::black,
15, Qt
::SolidLine, Qt
::RoundCap,
Qt::MiterJoin),
QBrush(Qt
::blue, Qt
::DiagCrossPattern));
MySlot::scene.setBackgroundBrush(Qt::red);
MySlot::view->update();
MySlot::view->setAttribute(Qt::WA_DeleteOnClose);
MySlot::view ->show();
}
Re: QGraphicsView Problem !!
I Got My incredible error :| , i was drawing circle"s" is the QSlider's value changed slot.
which gave me this bad result - many objects in the memory plus something like shadow appears - i solved it simply by drawing only one circle by this check :-
Code:
if (MySlot::MyE == NULL)
{
MySlot::MyE = MySlot::scene.addEllipse (10, 10, 10, 10,
MySlot::scene.setBackgroundBrush(Qt::red);
}
then added the code which controls the size and location of the circle
Code:
MySlot::MyE->setRect(GVar3, GVar2, GVar, GVar );
MySlot::view->setAttribute(Qt::WA_DeleteOnClose);
MySlot::view ->show();
MySlot::view->update();
Thanks :)