繁体   English   中英

QtCreator 如何识别正在使用哪个覆盖?

[英]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 来检查哪个通过更好

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM