Listing 2. Constructor with Timer Start demo_1::demo_1(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); //--- add the following lines. timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timer_tick())); timer->start(1000); }