解决 error: no matching member function for call to ‘connect‘

在连接信号槽时,报错error: no matching member function for call to 'connect'

connect(comboBox_com, &QComboBox::highlighted, this, &testOptionUSBRemote::refreshComList);

原因是由于里信号被重载过,同名了,但是参数不一样,就会报这个错误。

Q_SIGNALS:
    void highlighted(int index);
    void highlighted(const QString &);

这种情况下,需要使用旧版语法。

connect(comboBox_com, SIGNAL(highlighted(int)), this, SLOT(refreshComList(int)));

版权声明:本文为duapple原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。