Ha oki, in this case use QTimer like you said.
You can connect the timeout signal of timer in released signal of button.
On the pressed event of the button you start the timer.

Qt Code:
  1. // Attribute in .h file
  2. QTimer _timer;
  3.  
  4. // In the constructor for example
  5. connect(&this->_timer, SIGNAL(timeout()), this->ui->pushButton, SIGNAL(released()));
  6.  
  7. void MainWindow::on_pushButton_pressed()
  8. {
  9. _timer.start(1000);
  10. }
  11.  
  12. void MainWindow::on_pushButton_released()
  13. {
  14. qDebug() << "Button pressed while 1000 ms";
  15. _timer.stop();
  16. }
To copy to clipboard, switch view to plain text mode