diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-02-23 17:44:37 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-02-25 13:35:16 +0100 |
commit | be93534b314084330612c350dd58e695eb569646 (patch) | |
tree | c6bcaf5ebe2ebf132cea656be29f3a657f11f1a1 /examples | |
parent | b03bf04c19d4d9b81f92bd9a30ee7d26317a7315 (diff) |
Migrate from old signal/slot connection syntax
Exception is made for the cases, when the signals/slots are not known
at compile-time (i.e. involve dynamic replicas) or are defined in the
repc-generated files.
Pick-to: 5.15 5.12
Change-Id: Ice1fc78b59c713480531292a0401795df75523d7
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Diffstat (limited to 'examples')
8 files changed, 24 insertions, 22 deletions
diff --git a/examples/remoteobjects/cppclient/main.cpp b/examples/remoteobjects/cppclient/main.cpp index 96bcc46..08e36b6 100644 --- a/examples/remoteobjects/cppclient/main.cpp +++ b/examples/remoteobjects/cppclient/main.cpp @@ -62,10 +62,10 @@ public: ptr1.reset(m_client.acquire< MinuteTimerReplica >()); ptr2.reset(m_client.acquire< MinuteTimerReplica >()); ptr3.reset(m_client.acquire< MinuteTimerReplica >()); - QTimer::singleShot(0,this,SLOT(clear())); - QTimer::singleShot(1,this,SLOT(clear())); - QTimer::singleShot(10000,this,SLOT(clear())); - QTimer::singleShot(11000,this,SLOT(clear())); + QTimer::singleShot(0, this, &tester::clear); + QTimer::singleShot(1, this, &tester::clear); + QTimer::singleShot(10000, this, &tester::clear); + QTimer::singleShot(11000, this, &tester::clear); } public slots: void clear() diff --git a/examples/remoteobjects/modelviewserver/main.cpp b/examples/remoteobjects/modelviewserver/main.cpp index e0baaac..53627f4 100644 --- a/examples/remoteobjects/modelviewserver/main.cpp +++ b/examples/remoteobjects/modelviewserver/main.cpp @@ -157,11 +157,11 @@ int main(int argc, char *argv[]) view.show(); TimerHandler handler; handler.model = &sourceModel; - QTimer::singleShot(5000, &handler, SLOT(changeData())); - QTimer::singleShot(10000, &handler, SLOT(insertData())); - QTimer::singleShot(11000, &handler, SLOT(changeFlags())); - QTimer::singleShot(12000, &handler, SLOT(removeData())); - QTimer::singleShot(13000, &handler, SLOT(moveData())); + QTimer::singleShot(5000, &handler, &TimerHandler::changeData); + QTimer::singleShot(10000, &handler, &TimerHandler::insertData); + QTimer::singleShot(11000, &handler, &TimerHandler::changeFlags); + QTimer::singleShot(12000, &handler, &TimerHandler::removeData); + QTimer::singleShot(13000, &handler, &TimerHandler::moveData); return app.exec(); } diff --git a/examples/remoteobjects/simpleswitch/directconnectdynamicclient/dynamicclient.cpp b/examples/remoteobjects/simpleswitch/directconnectdynamicclient/dynamicclient.cpp index 11f64ab..88a3fd8 100644 --- a/examples/remoteobjects/simpleswitch/directconnectdynamicclient/dynamicclient.cpp +++ b/examples/remoteobjects/simpleswitch/directconnectdynamicclient/dynamicclient.cpp @@ -56,7 +56,8 @@ DynamicClient::DynamicClient(QSharedPointer<QRemoteObjectDynamicReplica> ptr) : QObject(nullptr), clientSwitchState(false), reptr(ptr) { //connect signal for replica valid changed with signal slot initialization - QObject::connect(reptr.data(), SIGNAL(initialized()), this, SLOT(initConnection_slot())); + QObject::connect(reptr.data(), &QRemoteObjectDynamicReplica::initialized, this, + &DynamicClient::initConnection_slot); } //destructor diff --git a/examples/remoteobjects/simpleswitch/directconnectserver/simpleswitch.cpp b/examples/remoteobjects/simpleswitch/directconnectserver/simpleswitch.cpp index a5ab3e0..5418ce1 100644 --- a/examples/remoteobjects/simpleswitch/directconnectserver/simpleswitch.cpp +++ b/examples/remoteobjects/simpleswitch/directconnectserver/simpleswitch.cpp @@ -54,7 +54,7 @@ SimpleSwitch::SimpleSwitch(QObject *parent) : SimpleSwitchSimpleSource(parent) { stateChangeTimer = new QTimer(this); // Initialize timer - QObject::connect(stateChangeTimer, SIGNAL(timeout()), this, SLOT(timeout_slot())); // connect timeout() signal from stateChangeTimer to timeout_slot() of simpleSwitch + QObject::connect(stateChangeTimer, &QTimer::timeout, this, &SimpleSwitch::timeout_slot); // connect timeout() signal from stateChangeTimer to timeout_slot() of simpleSwitch stateChangeTimer->start(2000); // Start timer and set timout to 2 seconds qDebug() << "Source Node Started"; } diff --git a/examples/remoteobjects/simpleswitch/registryconnectedclient/dynamicclient.cpp b/examples/remoteobjects/simpleswitch/registryconnectedclient/dynamicclient.cpp index 11f64ab..88a3fd8 100644 --- a/examples/remoteobjects/simpleswitch/registryconnectedclient/dynamicclient.cpp +++ b/examples/remoteobjects/simpleswitch/registryconnectedclient/dynamicclient.cpp @@ -56,7 +56,8 @@ DynamicClient::DynamicClient(QSharedPointer<QRemoteObjectDynamicReplica> ptr) : QObject(nullptr), clientSwitchState(false), reptr(ptr) { //connect signal for replica valid changed with signal slot initialization - QObject::connect(reptr.data(), SIGNAL(initialized()), this, SLOT(initConnection_slot())); + QObject::connect(reptr.data(), &QRemoteObjectDynamicReplica::initialized, this, + &DynamicClient::initConnection_slot); } //destructor diff --git a/examples/remoteobjects/simpleswitch/registryconnectedserver/simpleswitch.cpp b/examples/remoteobjects/simpleswitch/registryconnectedserver/simpleswitch.cpp index a5ab3e0..5418ce1 100644 --- a/examples/remoteobjects/simpleswitch/registryconnectedserver/simpleswitch.cpp +++ b/examples/remoteobjects/simpleswitch/registryconnectedserver/simpleswitch.cpp @@ -54,7 +54,7 @@ SimpleSwitch::SimpleSwitch(QObject *parent) : SimpleSwitchSimpleSource(parent) { stateChangeTimer = new QTimer(this); // Initialize timer - QObject::connect(stateChangeTimer, SIGNAL(timeout()), this, SLOT(timeout_slot())); // connect timeout() signal from stateChangeTimer to timeout_slot() of simpleSwitch + QObject::connect(stateChangeTimer, &QTimer::timeout, this, &SimpleSwitch::timeout_slot); // connect timeout() signal from stateChangeTimer to timeout_slot() of simpleSwitch stateChangeTimer->start(2000); // Start timer and set timout to 2 seconds qDebug() << "Source Node Started"; } diff --git a/examples/remoteobjects/ssl/sslcppclient/main.cpp b/examples/remoteobjects/ssl/sslcppclient/main.cpp index e468b57..a4f6b1c 100644 --- a/examples/remoteobjects/ssl/sslcppclient/main.cpp +++ b/examples/remoteobjects/ssl/sslcppclient/main.cpp @@ -75,10 +75,10 @@ public: ptr1.reset(m_client.acquire< MinuteTimerReplica >()); ptr2.reset(m_client.acquire< MinuteTimerReplica >()); ptr3.reset(m_client.acquire< MinuteTimerReplica >()); - QTimer::singleShot(0,this,SLOT(clear())); - QTimer::singleShot(1,this,SLOT(clear())); - QTimer::singleShot(10000,this,SLOT(clear())); - QTimer::singleShot(11000,this,SLOT(clear())); + QTimer::singleShot(0, this, &tester::clear); + QTimer::singleShot(1, this, &tester::clear); + QTimer::singleShot(10000, this, &tester::clear); + QTimer::singleShot(11000, this, &tester::clear); } public slots: void clear() diff --git a/examples/remoteobjects/websockets/wsserver/main.cpp b/examples/remoteobjects/websockets/wsserver/main.cpp index 698778c..391e1b7 100644 --- a/examples/remoteobjects/websockets/wsserver/main.cpp +++ b/examples/remoteobjects/websockets/wsserver/main.cpp @@ -195,11 +195,11 @@ int main(int argc, char *argv[]) view.show(); TimerHandler handler; handler.model = &sourceModel; - QTimer::singleShot(5000, &handler, SLOT(changeData())); - QTimer::singleShot(10000, &handler, SLOT(insertData())); - QTimer::singleShot(11000, &handler, SLOT(changeFlags())); - QTimer::singleShot(12000, &handler, SLOT(removeData())); - QTimer::singleShot(13000, &handler, SLOT(moveData())); + QTimer::singleShot(5000, &handler, &TimerHandler::changeData); + QTimer::singleShot(10000, &handler, &TimerHandler::insertData); + QTimer::singleShot(11000, &handler, &TimerHandler::changeFlags); + QTimer::singleShot(12000, &handler, &TimerHandler::removeData); + QTimer::singleShot(13000, &handler, &TimerHandler::moveData); return app.exec(); } |