1
0

UdpClientPage.h 635 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef UDP_CLIENT_PAGE_H
  2. #define UDP_CLIENT_PAGE_H
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QLineEdit>
  6. #include <QPushButton>
  7. #include "hv/UdpClient.h"
  8. class UdpClientPage : public QWidget
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit UdpClientPage(QWidget *parent = nullptr);
  13. ~UdpClientPage();
  14. bool start(int port, const char* host = "127.0.0.1");
  15. void stop();
  16. int send(const QString& msg);
  17. protected:
  18. void initUI();
  19. void initConnect();
  20. private:
  21. QLineEdit *hostEdt;
  22. QLineEdit *portEdt;
  23. QPushButton *startBtn;
  24. QPushButton *stopBtn;
  25. hv::UdpClient *client;
  26. };
  27. #endif // UDP_CLIENT_PAGE_H