31 lines
494 B
C++
31 lines
494 B
C++
#ifndef SERVER_H
|
|
#define SERVER_H
|
|
|
|
|
|
#include <QTcpServer>
|
|
#include "serverthread.h"
|
|
#include <QMetaType>
|
|
|
|
class Widget;//直接拿到父级对象指针
|
|
|
|
class Server : public QTcpServer
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit Server(QObject *parent = Q_NULLPTR);
|
|
~Server();
|
|
|
|
private:
|
|
virtual void incomingConnection(qintptr sockDesc);
|
|
|
|
private slots:
|
|
void clientDisconnected(QString IP);
|
|
void clientConnected(QString IP);
|
|
|
|
private:
|
|
Widget *m_widget;
|
|
|
|
};
|
|
|
|
#endif // SERVER_H
|