QT定时器应该怎样使用呢?

  QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
    timer->start(1000);

这里必须要有this吗,SLOT的函数能不能不属于某个类呢?
我想在3秒后MainWindow的w关闭并显示另一个窗口(w2.show()),但是不知道怎样写,上面是官方文档的一段代码

http://blog.csdn.net/steven6977/article/details/9310997

你构造定时器的时候就把对应类的指针传给QTimer,ranhslot中设置函数,定时器到了就触发你对应类的函数。