Commit 6b11855c authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Daniel Agar

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.
parent ea87ffca
......@@ -118,26 +118,26 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
switch(source->type()) {
#ifndef NO_SERIAL_LINK
case TypeSerial:
dupe = new SerialConfiguration(dynamic_cast<SerialConfiguration*>(source));
dupe = new SerialConfiguration(qobject_cast<SerialConfiguration*>(source));
break;
#endif
case TypeUdp:
dupe = new UDPConfiguration(dynamic_cast<UDPConfiguration*>(source));
dupe = new UDPConfiguration(qobject_cast<UDPConfiguration*>(source));
break;
case TypeTcp:
dupe = new TCPConfiguration(dynamic_cast<TCPConfiguration*>(source));
dupe = new TCPConfiguration(qobject_cast<TCPConfiguration*>(source));
break;
#ifdef QGC_ENABLE_BLUETOOTH
case TypeBluetooth:
dupe = new BluetoothConfiguration(dynamic_cast<BluetoothConfiguration*>(source));
dupe = new BluetoothConfiguration(qobject_cast<BluetoothConfiguration*>(source));
break;
#endif
case TypeLogReplay:
dupe = new LogReplayLinkConfiguration(dynamic_cast<LogReplayLinkConfiguration*>(source));
dupe = new LogReplayLinkConfiguration(qobject_cast<LogReplayLinkConfiguration*>(source));
break;
#ifdef QT_DEBUG
case TypeMock:
dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source));
dupe = new MockConfiguration(qobject_cast<MockConfiguration*>(source));
break;
#endif
case TypeLast:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment