diff options
| author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-22 13:47:08 +0100 |
|---|---|---|
| committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-24 13:17:33 +0100 |
| commit | 502d3d6744913899da87acfda5ebdab42c40329e (patch) | |
| tree | 16658a328503bfd5a62b4fd5d69ffb66e9854b18 /examples/network/googlesuggest/googlesuggest.cpp | |
| parent | d1be8b9ceb2c7b20bbe53a07154c79699540ea3d (diff) | |
| parent | 06bb315beb6c2c398223cfe52cbc7f66e14a8557 (diff) | |
Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
Diffstat (limited to 'examples/network/googlesuggest/googlesuggest.cpp')
| -rw-r--r-- | examples/network/googlesuggest/googlesuggest.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp index d27beafd1e0..1ae515f5305 100644 --- a/examples/network/googlesuggest/googlesuggest.cpp +++ b/examples/network/googlesuggest/googlesuggest.cpp @@ -48,9 +48,9 @@ ** ****************************************************************************/ -//! [1] #include "googlesuggest.h" +//! [1] const QString gsuggestUrl(QStringLiteral("http://google.com/complete/search?output=toolbar&q=%1")); //! [1] @@ -74,16 +74,18 @@ GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), edit popup->installEventFilter(this); - connect(popup, SIGNAL(itemClicked(QTreeWidgetItem*,int)), - SLOT(doneCompletion())); + connect(popup, &QTreeWidget::itemClicked, + this, &GSuggestCompletion::doneCompletion); timer.setSingleShot(true); timer.setInterval(500); - connect(&timer, SIGNAL(timeout()), SLOT(autoSuggest())); - connect(editor, SIGNAL(textEdited(QString)), &timer, SLOT(start())); + connect(&timer, &QTimer::timeout, + this, &GSuggestCompletion::autoSuggest); + connect(editor, &QLineEdit::textEdited, + &timer, QOverload<>::of(&QTimer::start)); - connect(&networkManager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(handleNetworkData(QNetworkReply*))); + connect(&networkManager, &QNetworkAccessManager::finished, + this, &GSuggestCompletion::handleNetworkData); } //! [2] @@ -207,7 +209,7 @@ void GSuggestCompletion::preventSuggest() void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply) { QUrl url = networkReply->url(); - if (networkReply->error() == QNetworkReply::NoError) { + if (networkReply->networkError() == QNetworkReply::NoError) { QVector<QString> choices; QByteArray response(networkReply->readAll()); |
