Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/159.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Qt connect()插槽和“this”指针_C++_Qt_Class_Signals_Slot - Fatal编程技术网

C++ Qt connect()插槽和“this”指针

C++ Qt connect()插槽和“this”指针,c++,qt,class,signals,slot,C++,Qt,Class,Signals,Slot,以下代码起作用: connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(myMemberFunction())); 另一个没有: connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(this->myMemberFunction())); 为什么?SLOT宏编写的函数可以作为函数指针来传递插槽,它使用参数作为名称,本身不是函数调用。SLOT宏编写的函数可以作为函数指针来传递插槽,它使

以下代码起作用:

connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(myMemberFunction()));
另一个没有:

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

为什么?

SLOT宏编写的函数可以作为函数指针来传递插槽,它使用参数作为名称,本身不是函数调用。

SLOT宏编写的函数可以作为函数指针来传递插槽,它使用参数作为名称,它本身不是一个函数调用。

它进行编译,但似乎不接受调用connect的位置的有效插槽?它进行编译,但似乎不接受调用connect的位置的有效插槽?