then read C++ documentation

Qt Code:
  1. /// Server.h
  2. # ifndef SERVER_H
  3. # define SERVER_H
  4.  
  5. # include <QThread>
  6. # include "ServerGUI.h"
  7.  
  8. class Server : public QThread
  9. {
  10. Q_OBJECT
  11.  
  12. protected:
  13. void run();
  14.  
  15. public slots:
  16. void new_client();
  17. };
  18.  
  19. # endif
  20.  
  21.  
  22. /// Server.cpp
  23. # include <iostream>
  24. # include "Server.h"
  25.  
  26. Server :: Server()
  27. {
  28.  
  29. };
  30.  
  31.  
  32. void Server :: new_client()
  33. {
  34. std::cout << "New client connected\n";
  35. }
  36.  
  37. void Server :: run()
  38. {
  39. std::cout << "Thread running\n";
  40. }
To copy to clipboard, switch view to plain text mode 

Then after you create object Server call method start() and your thread will be started