From 42ad3de71b5eec2f80906b678685260701d56515 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 19 Aug 2019 11:28:54 +0200 Subject: [PATCH] CustomPlugin: Use qobject_cast qobject_cast is times faster then dynamic_cast for objects that inherit QObject. Also, use auto keyword to not duplicate the name of the Class --- custom-example/src/CustomPlugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc index f715a4e68..a0ba656d9 100644 --- a/custom-example/src/CustomPlugin.cc +++ b/custom-example/src/CustomPlugin.cc @@ -47,7 +47,7 @@ customQuickInterfaceSingletonFactory(QQmlEngine*, QJSEngine*) { qCDebug(CustomLog) << "Creating CustomQuickInterface instance"; CustomQuickInterface* pIFace = new CustomQuickInterface(); - CustomPlugin* pPlug = dynamic_cast(qgcApp()->toolbox()->corePlugin()); + auto* pPlug = qobject_cast(qgcApp()->toolbox()->corePlugin()); if(pPlug) { pIFace->init(); } else { -- 2.22.0