diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-01-10 08:07:58 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-11 14:20:17 +0000 |
commit | 8b47858231b996e8bfc303f0e52632f3f34ee24f (patch) | |
tree | b73e7df95eff0ebf7e1b144693a741069c0b8697 /src/network | |
parent | 23475c7cf175ecfa2bdeb6c4cfe66de53c741e68 (diff) | |
download | qtbase-8b47858231b996e8bfc303f0e52632f3f34ee24f.tar.gz |
Documentation: Port code snippets to new connection syntax
Task-number: PYSIDE-2182
Change-Id: I5f800cf3a4a7afefbc36a79372fc35449fa953f0
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8fccba0e63f9484866398e77a7e8ee54ed80a0a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network')
3 files changed, 7 insertions, 12 deletions
diff --git a/src/network/doc/snippets/code/src_network_kernel_qdnslookup.cpp b/src/network/doc/snippets/code/src_network_kernel_qdnslookup.cpp index fdcc8b0ce4..ce976001bb 100644 --- a/src/network/doc/snippets/code/src_network_kernel_qdnslookup.cpp +++ b/src/network/doc/snippets/code/src_network_kernel_qdnslookup.cpp @@ -6,8 +6,7 @@ void MyObject::lookupServers() { // Create a DNS lookup. dns = new QDnsLookup(this); - connect(dns, SIGNAL(finished()), - this, SLOT(handleServers())); + connect(dns, &QDnsLookup::finished, this, &MyObject::handleServers); // Find the XMPP servers for gmail.com dns->setType(QDnsLookup::SRV); diff --git a/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp b/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp index b845e5bcc7..7c39827b94 100644 --- a/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp +++ b/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp @@ -3,12 +3,10 @@ //! [0] // To find the IP address of qt-project.org -QHostInfo::lookupHost("qt-project.org", - this, SLOT(printResults(QHostInfo))); +QHostInfo::lookupHost("qt-project.org", this, &MyWidget::printResults); // To find the host name for 4.2.2.1 -QHostInfo::lookupHost("4.2.2.1", - this, SLOT(printResults(QHostInfo))); +QHostInfo::lookupHost("4.2.2.1", this, &MyWidget::printResults); //! [0] @@ -18,8 +16,7 @@ QHostInfo info = QHostInfo::fromName("qt-project.org"); //! [2] -QHostInfo::lookupHost("www.kde.org", - this, SLOT(lookedUp(QHostInfo))); +QHostInfo::lookupHost("www.kde.org", this, &MyWidget::lookedUp); //! [2] @@ -39,8 +36,7 @@ void MyWidget::lookedUp(const QHostInfo &host) //! [4] -QHostInfo::lookupHost("4.2.2.1", - this, SLOT(lookedUp(QHostInfo))); +QHostInfo::lookupHost("4.2.2.1", this, &MyWidget::lookedUp); //! [4] diff --git a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp index 6ad795fcb9..89d82d66f8 100644 --- a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp +++ b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp @@ -5,7 +5,7 @@ using namespace Qt::StringLiterals; //! [0] QSslSocket *socket = new QSslSocket(this); -connect(socket, SIGNAL(encrypted()), this, SLOT(ready())); +connect(socket, &QSslSocket::encrypted, this, &Receiver::ready); socket->connectToHostEncrypted("imap.example.com", 993); //! [0] @@ -42,7 +42,7 @@ while (socket.waitForReadyRead()) //! [3] QSslSocket socket; -connect(&socket, SIGNAL(encrypted()), receiver, SLOT(socketEncrypted())); +connect(&socket, &QSslSocket::encrypted, receiver, &Receiver::socketEncrypted); socket.connectToHostEncrypted("imap", 993); socket->write("1 CAPABILITY\r\n"); |