I'm building a very simple image editor on Qt creator.I have my image displayed on a QGraphicsView and i want to give the user the ability to zoom in and out by a pushbutton.

I've searched a lot and found how to zoom in and out through the mouse wheel.As i am very new to Qt i can't adjust it to the pushbutton because i don't understand everything clearly.

I' ve tried this(without understanding completely what i'm doing)but the result isn't the wanted.It zooms in only once and quite abruptly.I want a smoother zoom and as many times as i want.

Qt Code:
  1. void MainWindow::on_pushButton_clicked(){
  2. QMatrix matrix;
  3. ui->graphicsView->setTransformationAnchor(QGraphicsView::AnchorViewCenter);
  4. matrix.scale(1.0,1.0);
  5. ui->graphicsView->setMatrix(matrix);
  6. ui->graphicsView->scale(1,-1);}
To copy to clipboard, switch view to plain text mode 

I would be very grateful if you guys can help!