i'm making a project, one of its parts in to control the size and place of any shape using sliders.

what i have got till now is, The shape's size is increasing when the slider's value increases,
the Problem is when decreasing the value of the slider, Nothing happen to the shape.

here is wt i did

Qt Code:
  1. // MYSlot.h
  2. public:
  3. int GVar;
  4. QGraphicsView * view;
  5.  
  6. public slots:
  7. void Slider_ValueChanged();
  8.  
  9. private:
  10. Ui_MyForm ui;
To copy to clipboard, switch view to plain text mode 
--------------------------------------------

Qt Code:
  1. // MySlot.cpp
  2.  
  3. // The Constructor
  4.  
  5. MySlot::MySlot(QWidget *parent)
  6. : QWidget(parent)
  7. {
  8. Ui_MyForm d;
  9. MySlot::GVar=1;
  10. //scene = new QGraphicsScene;
  11. view = new QGraphicsView(&(MySlot::scene));
  12. ui.setupUi(this);
  13. }
To copy to clipboard, switch view to plain text mode 
----------------------------------------

Slider Value Changed Slot.

Qt Code:
  1. void MySlot::Slider_ValueChanged()
  2. {
  3. GVar= (int)(ui.horizontalSlider->value());
  4. MySlot::scene.addEllipse (10, 10, GVar, 10,
  5. QPen(Qt::black, 15, Qt::SolidLine, Qt::RoundCap,
  6. Qt::MiterJoin),
  7. QBrush(Qt::blue, Qt::DiagCrossPattern));
  8.  
  9. MySlot::scene.setBackgroundBrush(Qt::red);
  10. MySlot::view->setAttribute(Qt::WA_DeleteOnClose);
  11. CustomSlot::view ->show();
  12.  
  13. }
To copy to clipboard, switch view to plain text mode 

Again, The Problem is .. When the slider's value increases, the shape's size increases, when the slider's value decreases, Nothing happen to the shape.

Thanks