diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-09-20 16:34:21 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-09-25 18:43:35 +0000 |
commit | a732e16d5fd9dbf8a0289fec9f948b12e9ba2c19 (patch) | |
tree | 414d6ee2b615cb8c611cde805a39bb76b3870b58 /examples/network/multicastsender/sender.h | |
parent | ddb191e47a25a8a5c19cb01bec05c9538b22adf7 (diff) |
QtNetwork (examples) - update multicastsender
Similar to broadcast sender:
- where possible use local variables instead of data-members
- where possible avoid heap-allocated objects, use sub-objects instead
- change signal-slot connection syntax (and as a "bonus" - show our QOverload)
Task-number: QTBUG-60628
Change-Id: I8cd4f888c1d0653bdc8591800e713bbd347ad2fb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'examples/network/multicastsender/sender.h')
-rw-r--r-- | examples/network/multicastsender/sender.h | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/examples/network/multicastsender/sender.h b/examples/network/multicastsender/sender.h index 8e10f88c0d..5d8769790e 100644 --- a/examples/network/multicastsender/sender.h +++ b/examples/network/multicastsender/sender.h @@ -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. @@ -51,24 +51,16 @@ #ifndef SENDER_H #define SENDER_H -#include <QDialog> -#include <QHostAddress> - -QT_BEGIN_NAMESPACE -class QDialogButtonBox; -class QLabel; -class QPushButton; -class QTimer; -class QUdpSocket; -class QSpinBox; -QT_END_NAMESPACE +#include <QtWidgets> +#include <QtNetwork> +#include <QtCore> class Sender : public QDialog { Q_OBJECT public: - Sender(QWidget *parent = 0); + explicit Sender(QWidget *parent = nullptr); private slots: void ttlChanged(int newTtl); @@ -76,16 +68,12 @@ private slots: void sendDatagram(); private: - QLabel *statusLabel; - QLabel *ttlLabel; - QSpinBox *ttlSpinBox; - QPushButton *startButton; - QPushButton *quitButton; - QDialogButtonBox *buttonBox; - QUdpSocket *udpSocket; - QTimer *timer; + QLabel *statusLabel = nullptr; + QPushButton *startButton = nullptr; + QUdpSocket udpSocket; + QTimer timer; QHostAddress groupAddress; - int messageNo; + int messageNo = 1; }; #endif |