QT新增类使用connect注意功能

40 阅读1分钟

QT新增类使用connect功能参函数,注意该继承QObject,不然会有编译错误!

项目新增net类:

  • net.h image.png

  • net.cpp 使用connect绑定

image.png

  • 执行报错:
C:\Users\HW\Documents\QT-TEST\\net.cpp:75: 
error: Cannot initialize a parameter of type 'const char *' with an rvalue of type 'void (QNetworkReply::*)()'

修改:

image.png