我正在尝试:
connect(myButton, SIGNAL(mouseReleaseEvent(QMouseEvent*)),
this, SLOT(ShowContextMenu(QMouseEvent*)));
但收到错误消息:
QObject::connect: No such signal QToolButton::mouseReleaseEvent(QMouseEvent*)
qt 5.4-我做错了什么?
假设myButton属于QPushButton类,则可以使用released()信号:
connect(myButton, SIGNAL(released()),
this, SLOT(ShowContextMenu()));
假设可以在没有参数的情况下调用slot"ShowContextMenu"。另请参阅QT文档。