这个错误是由于无法找到匹配的 connect 函数导致的。根据错误信息,connect 函数无法解析 QComboBox 的 currentIndexChanged 信号的重载函数类型。

要解决这个问题,可以使用 QOverload 来指定信号的重载函数类型。修改代码如下:

connect(ui->mode, QOverload<const QString&>::of(&QComboBox::currentIndexChanged), this, [this](const QString& mode){
    on_modeComboBox_currentIndexChanged(mode);
});

这样就能正确连接信号和槽函数了。

Qt connect 函数无法解析 QComboBox currentIndexChanged 信号的解决方法

原文地址: https://www.cveoy.top/t/topic/fA9K 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录