How to use QTimer
In QT I'm trying to set a Qtimer that calls a function called "update" every second. Here is my code:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QTimer>
    #include "QDebug"

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);

        QTimer *timer = new QTimer();
        connect(timer, SIGNAL(timeout()), this, SLOT(update()));
        timer->start(1000);
    }
 
    MainWindow::~MainWindow()
    {
        delete ui;
    }

    void MainWindow::update()
    {
        qDebug() << "update";
    }

THe project is being build, but it doesnt execute update, since the line "update" is not showing anywhere... Does anybody see what I´m doing wrong?
How to use QTimer
===

In QT I'm trying to set a Qtimer that calls a function called "update" every second. Here is my code:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QTimer>
    #include "QDebug"

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);

        QTimer *timer = new QTimer();
        connect(timer, SIGNAL(timeout()), this, SLOT(update()));
        timer->start(1000);
    }
 
    MainWindow::~MainWindow()
    {
        delete ui;
    }

    void MainWindow::update()
    {
        qDebug() << "update";
    }

THe project is being build, but it doesnt execute update, since the line "update" is not showing anywhere... Does anybody see what I´m doing wrong?