summaryrefslogtreecommitdiffstats
path: root/examples/remoteobjects/ssl/sslcppclient/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/remoteobjects/ssl/sslcppclient/main.cpp')
-rw-r--r--examples/remoteobjects/ssl/sslcppclient/main.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/examples/remoteobjects/ssl/sslcppclient/main.cpp b/examples/remoteobjects/ssl/sslcppclient/main.cpp
index 9d49a12..33a3437 100644
--- a/examples/remoteobjects/ssl/sslcppclient/main.cpp
+++ b/examples/remoteobjects/ssl/sslcppclient/main.cpp
@@ -11,12 +11,13 @@
#include <QRemoteObjectNode>
-class tester : public QObject
+class Tester : public QObject
{
Q_OBJECT
public:
- tester() : QObject(nullptr)
+ Tester() : QObject(nullptr)
{
+ //! [0]
QRemoteObjectNode m_client;
auto socket = setupConnection();
connect(socket, &QSslSocket::errorOccurred,
@@ -24,35 +25,49 @@ public:
qDebug() << "QSslSocket::error" << error;
}) ;
m_client.addClientSideConnection(socket);
+ //! [0]
+ //! [1]
ptr1.reset(m_client.acquire< MinuteTimerReplica >());
ptr2.reset(m_client.acquire< MinuteTimerReplica >());
ptr3.reset(m_client.acquire< MinuteTimerReplica >());
- QTimer::singleShot(0, this, &tester::clear);
- QTimer::singleShot(1, this, &tester::clear);
- QTimer::singleShot(10000, this, &tester::clear);
- QTimer::singleShot(11000, this, &tester::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);
+ //! [1]
}
public slots:
+
+ //! [2]
void clear()
{
static int i = 0;
if (i == 0) {
i++;
+ if (ptr1.isNull())
+ qCritical() << "Pointer 1 was not set";
ptr1.reset();
} else if (i == 1) {
i++;
+ if (ptr2.isNull())
+ qCritical() << "Pointer 2 was not set";
ptr2.reset();
} else if (i == 2) {
i++;
+ if (ptr3.isNull())
+ qCritical() << "Pointer 3 was not set";
ptr3.reset();
} else {
qApp->quit();
}
}
+ //! [2]
private:
- QScopedPointer<MinuteTimerReplica> ptr1, ptr2, ptr3;
+ QScopedPointer<MinuteTimerReplica> ptr1;
+ QScopedPointer<MinuteTimerReplica> ptr2;
+ QScopedPointer<MinuteTimerReplica> ptr3;
QSslSocket *setupConnection()
{
@@ -70,6 +85,7 @@ private:
}
};
+//! [3]
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@@ -78,8 +94,9 @@ int main(int argc, char *argv[])
config.setCaCertificates(QSslCertificate::fromPath(QStringLiteral(":/sslcert/rootCA.pem")));
QSslConfiguration::setDefaultConfiguration(config);
- tester t;
+ Tester t;
return a.exec();
}
+//! [3]
#include "main.moc"