在 QtCreator 中,当您将鼠标悬停在 Qt 函数上时,它会为您提供上下文帮助,为调用提供所有各种重载的编号。
问题是,在 QObject::connect 的情况下,有 8 个可用的重载,我怎么知道实际使用了哪一个?
我有现有代码,我正在尝试确定正在使用的重载方法,以便我可以清理代码并使用类型来替换:
QObject::connect(this
,&clsQtPushBtn::clicked
,[pobjScriptEng, strCall, strFile, strScript]() {
if ( strCall.isEmpty() != true ) {
QString strScriptWithCall = static_cast<QString>(strScript)
+ static_cast<QString>(strCall) + "();";
pobjScriptEng->evaluate(strScriptWithCall);
}
});
我想要做的是替换参数,将下面的代码分配给一个临时变量并将其分配为参数:
[pobjScriptEng, strCall, strFile, strScript]() {
if ( strCall.isEmpty() != true ) {
QString strScriptWithCall = static_cast<QString>(strScript)
+ static_cast<QString>(strCall) + "();";
pobjScriptEng->evaluate(strScriptWithCall);
}
}
这是因为我想在其他连接中重用相同的参数而不必复制源。
最佳答案
关于c++ - QtCreator如何识别正在使用的是哪个override?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54691126/