diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-09-29 13:57:43 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-10-05 03:45:26 +0000 |
commit | aeee3be166aff737990fe2cade05bff7b39dfebc (patch) | |
tree | d1e5a2085bd0df3cd204a4b0121e5178f1a61862 /examples/network/googlesuggest/googlesuggest.h | |
parent | 5b4cf7af6a492b6ef5b7c718b346b38ddad4c990 (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 <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'examples/network/googlesuggest/googlesuggest.h')
-rw-r--r-- | examples/network/googlesuggest/googlesuggest.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/examples/network/googlesuggest/googlesuggest.h b/examples/network/googlesuggest/googlesuggest.h index 1d42f31571..a0b0ac069c 100644 --- a/examples/network/googlesuggest/googlesuggest.h +++ b/examples/network/googlesuggest/googlesuggest.h @@ -53,14 +53,7 @@ #include <QtWidgets> #include <QtNetwork> -#include <QObject> - -QT_BEGIN_NAMESPACE -class QLineEdit; -class QNetworkReply; -class QTimer; -class QTreeWidget; -QT_END_NAMESPACE +#include <QtCore> //! [1] class GSuggestCompletion : public QObject @@ -68,10 +61,10 @@ class GSuggestCompletion : public QObject Q_OBJECT public: - GSuggestCompletion(QLineEdit *parent = 0); + explicit GSuggestCompletion(QLineEdit *parent = nullptr); ~GSuggestCompletion(); bool eventFilter(QObject *obj, QEvent *ev) override; - void showCompletion(const QStringList &choices); + void showCompletion(const QVector<QString> &choices); public slots: @@ -81,9 +74,9 @@ public slots: void handleNetworkData(QNetworkReply *networkReply); private: - QLineEdit *editor; - QTreeWidget *popup; - QTimer *timer; + QLineEdit *editor = nullptr; + QTreeWidget *popup = nullptr; + QTimer timer; QNetworkAccessManager networkManager; }; //! [1] |