summaryrefslogtreecommitdiffstats
path: root/examples/network/googlesuggest/searchbox.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <[email protected]>2017-09-29 13:57:43 +0200
committerTimur Pocheptsov <[email protected]>2017-10-05 03:45:26 +0000
commitaeee3be166aff737990fe2cade05bff7b39dfebc (patch)
treed1e5a2085bd0df3cd204a4b0121e5178f1a61862 /examples/network/googlesuggest/searchbox.cpp
parent5b4cf7af6a492b6ef5b7c718b346b38ddad4c990 (diff)
QtNetwork (examples) - update googlesuggest example
Mainly cosmetic - nullptr, explicit, QVector<QString> etc. Plus: do not leak SearchBox. Task-number: QTBUG-60628 Change-Id: I4c538ced64a469fbe4627f44d2d883e6dcd2362e Reviewed-by: MÃ¥rten Nordheim <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'examples/network/googlesuggest/searchbox.cpp')
-rw-r--r--examples/network/googlesuggest/searchbox.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp
index e0754a7de2a..d0bdb70daa1 100644
--- a/examples/network/googlesuggest/searchbox.cpp
+++ b/examples/network/googlesuggest/searchbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -54,7 +54,7 @@
#include "searchbox.h"
#include "googlesuggest.h"
-#define GSEARCH_URL "http://www.google.com/search?q=%1"
+const QString gsearchUrl = QStringLiteral("http://www.google.com/search?q=%1");
//! [1]
SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
@@ -75,8 +75,8 @@ SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
void SearchBox::doSearch()
{
completer->preventSuggest();
- QString url = QString(GSEARCH_URL).arg(text());
- QDesktopServices::openUrl(QUrl(url));
+ QString url = gsearchUrl.arg(text());
+ QDesktopServices::openUrl(url);
}
//! [2]