From 6b11855ce450defaf0227b119f53c032b2de0af8 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 19 Aug 2019 11:37:17 +0200 Subject: [PATCH] LinkConfiguration: use qobject_cast instead of dynamic_cast qobject_cast is times faster dynamic_cast for objects that inherit QObject. also, use auto keyword to not duplicate class names. --- src/comm/LinkConfiguration.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/comm/LinkConfiguration.cc b/src/comm/LinkConfiguration.cc index 6168ccf6e..dc2cbd567 100644 --- a/src/comm/LinkConfiguration.cc +++ b/src/comm/LinkConfiguration.cc @@ -118,26 +118,26 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc switch(source->type()) { #ifndef NO_SERIAL_LINK case TypeSerial: - dupe = new SerialConfiguration(dynamic_cast(source)); + dupe = new SerialConfiguration(qobject_cast(source)); break; #endif case TypeUdp: - dupe = new UDPConfiguration(dynamic_cast(source)); + dupe = new UDPConfiguration(qobject_cast(source)); break; case TypeTcp: - dupe = new TCPConfiguration(dynamic_cast(source)); + dupe = new TCPConfiguration(qobject_cast(source)); break; #ifdef QGC_ENABLE_BLUETOOTH case TypeBluetooth: - dupe = new BluetoothConfiguration(dynamic_cast(source)); + dupe = new BluetoothConfiguration(qobject_cast(source)); break; #endif case TypeLogReplay: - dupe = new LogReplayLinkConfiguration(dynamic_cast(source)); + dupe = new LogReplayLinkConfiguration(qobject_cast(source)); break; #ifdef QT_DEBUG case TypeMock: - dupe = new MockConfiguration(dynamic_cast(source)); + dupe = new MockConfiguration(qobject_cast(source)); break; #endif case TypeLast: -- 2.22.0