Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下代码有效:
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(myMemberFunction()));
另一个没有:
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(this->myMemberFunction()));
为什么?
SLOT() 宏编写了一个可以调用的函数(作为函数指针)来传递插槽,它使用参数作为名称,它本身不是函数调用。