diff options
Diffstat (limited to 'examples/network/googlesuggest/searchbox.cpp')
-rw-r--r-- | examples/network/googlesuggest/searchbox.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp deleted file mode 100644 index 56ca44dac4..0000000000 --- a/examples/network/googlesuggest/searchbox.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QDesktopServices> -#include <QUrl> - -#include "searchbox.h" -#include "googlesuggest.h" - -const QString gsearchUrl = QStringLiteral("http://www.google.com/search?q=%1"); - -//! [1] -SearchBox::SearchBox(QWidget *parent) - : QLineEdit(parent) - , completer(new GSuggestCompletion(this)) -{ - connect(this, &SearchBox::returnPressed, this, &SearchBox::doSearch); - - setWindowTitle("Search with Google"); - - adjustSize(); - resize(400, height()); - setFocus(); -} -//! [1] - -//! [2] -void SearchBox::doSearch() -{ - completer->preventSuggest(); - QString url = gsearchUrl.arg(text()); - QDesktopServices::openUrl(url); -} -//! [2] - |