Qt 槽函数的使用

今天在代码中遇到这样一个问题,自己感觉槽和函数都写的没错,但是就是不执行槽函数,因为是一个定时器的使用,即定时时间到了就执行槽函数。

 1 SeventhWizardPage::SeventhWizardPage(QWidget *parent) :
 2     QWizardPage(parent),
 3     ui(new Ui::SeventhWizardPage),
 4     parent(parent)
 5 {
 6     ui->setupUi(this);
 7     m_pDispatcher = new CSCSETLDispatcher;
 8     m_pTimer = new QTimer(this);
 9     connect(m_pTimer, SIGNAL(timeout()), this, SLOT(UpdateData));
10 }

自己看了好久才发现其中的错误,就是在connect中写槽函数时忘记加括号了,然而编译也通过了,但是就是定时到了不执行槽函数。希望不要再犯如此小错误。

原文地址:https://www.cnblogs.com/lit10050528/p/3934279.html