QtCreator如何识别正在使用的是哪个override?
QtCreator how to identify which override is being used?
在 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);
}
}
这是因为我想在其他连接中重复使用相同的参数而不必复制源。
你在连接中有 lambda,所以所有可能的重载方法的选项 7
您可以在参数中使用 ctrl + space 来检查哪个通过得更好
在 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);
}
}
这是因为我想在其他连接中重复使用相同的参数而不必复制源。
你在连接中有 lambda,所以所有可能的重载方法的选项 7
您可以在参数中使用 ctrl + space 来检查哪个通过得更好