title: Qt Progressbar Incrementing more than it should
body: <p>So what I want is just incrementing the progressbar with a timer. But somehow it increments the progressbar more than it should.</p>
  
  <p>mainwindow.h :</p>
  
  <pre><code>Class MainWindow {
  //...
  private slots:
  //...
      void update();
  private:
      Ui::MainWindow *ui;
      QTimer *timer;
      unsigned int counter;
  };
  </code></pre>
  
  <p>mainwindow.cpp :</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      timer = new QTimer(this);
      counter = 0;
      connect(timer, SIGNAL(timeout()), this, SLOT( update() ) );
  }
  
  void MainWindow::on_actionStart_triggered()
  {
      if( ui-&gt;txtTime-&gt;text().isEmpty() || (ui-&gt;txtTime-&gt;text().toInt() == 0) )
      {
          QMessageBox::warning(this, "Error", "Could not start the timer.", QMessageBox::Ok);
          return;
      }
  
      ui-&gt;cmdStart-&gt;setEnabled(false);
      timer-&gt;start(ui-&gt;txtTime-&gt;text().toInt() * 60000  / 60);
  }
  
  
  void MainWindow::update()
  {
      counter++;
      ui-&gt;progressBar-&gt;setValue( counter ); //Should be incremented by one
      if( ui-&gt;progressBar-&gt;value() == 60 )
      {
          timer-&gt;stop();
          Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory,
                                                            Phonon::MediaSource( ":/Music/" + ui-&gt;chkMusic-&gt;currentText() ));
          music-&gt;play();  //Playing music
          delete timer;
      }
  }
  </code></pre>
  
  <p>I've noticed with the debugger that the progressbar had a value of 6 while the counter had only the value 4. Also it increments first 1, then 2, then 2 again and then 1, and so on. What am I doing wrong?!</p>
  
  <p>Edit:
  I think it is the progressbar. I changed the action to this :</p>
  
  <pre><code>void MainWindow::on_actionStart_triggered()
  {
      if( ui-&gt;txtTime-&gt;text().isEmpty() || (ui-&gt;txtTime-&gt;text().toInt() == 0) )
      {
          QMessageBox::warning(this, "Error", "Could not start the timer.", QMessageBox::Ok);
          return;
      }
  
     // ui-&gt;cmdStart-&gt;setEnabled(false);
     // ui-&gt;progressBar-&gt;setMaximum( ui-&gt;txtTime-&gt;text().toInt() * 60 );
     // timer-&gt;start( 1000 );
      counter++;
      ui-&gt;progressBar-&gt;setValue( counter );
  }
  </code></pre>
  
  <p>No timer will be started since I commented it out. Always when I click on the action button it increments the progressbar by 1, then 2, then 2 again and then 1. Same behavior. So it's not the timer!</p>