解决 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)));

猜你喜欢

转载自blog.csdn.net/duapple/article/details/129507801
今日推荐