简体   繁体   中英

Qt connect() SLOT and “this” pointer

The following code works:

connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(myMemberFunction()));

That other doesn't:

connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(this->myMemberFunction()));

Why?

SLOT()宏编写了一个可以调用(作为函数指针)以交付插槽的函数,它使用参数作为名称,但它本身并不是函数调用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM