I tried doing my own implementation of these classes. Actually, I used the exact same code that is used in the simple network example in the Qt help files. Later on, I will have to change the newConnection function to do what I want it do, but for now, the only difference is that I want to us a different GUI, created with Qt designer, and I can't seem to get it work.

Instead of having this class in a cpp file:

Qt Code:
  1. class ServerInfo : public QVBox
  2. {
  3. Q_OBJECT
  4. public:
  5. ServerInfo()
  6. {
  7. SimpleServer *server = new SimpleServer( this );
  8.  
  9. QString itext = tr(
  10. "This is a small server example.\n"
  11. "Connect with the client now."
  12. );
  13. QLabel *lb = new QLabel( itext, this );
  14. lb->setAlignment( AlignHCenter );
  15. infoText = new QTextView( this );
  16. QPushButton *quit = new QPushButton( tr("Quit") , this );
  17.  
  18. connect( server, SIGNAL(newConnect(ClientSocket*)),
  19. SLOT(newConnect(ClientSocket*)) );
  20. connect( quit, SIGNAL(clicked()), qApp,
  21. SLOT(quit()) );
  22. }
  23.  
  24. ~ServerInfo()
  25. {
  26. }
  27.  
  28. private slots:
  29. void newConnect( ClientSocket *s )
  30. {
  31. infoText->append( tr("New connection\n") );
  32. connect( s, SIGNAL(logText(const QString&)),
  33. infoText, SLOT(append(const QString&)) );
  34. connect( s, SIGNAL(connectionClosed()),
  35. SLOT(connectionClosed()) );
  36. }
  37.  
  38. void connectionClosed()
  39. {
  40. infoText->append( tr("Client closed connection\n") );
  41. }
  42.  
  43. private:
  44. QTextView *infoText;
  45. };
To copy to clipboard, switch view to plain text mode 


I have this in a form.ui.h file. (infoText text browser was created in qt designer)

Qt Code:
  1. #include "clientsocket.h"
  2. #include "server.h"
  3.  
  4. void Form1::init(){
  5. SimpleServer *server = new SimpleServer( this );
  6. connect( server, SIGNAL(newConnect(ClientSocket*)),
  7. SLOT(newConnect(ClientSocket*)) );
  8. }
  9.  
  10. void Form1::newConnect( ClientSocket *s ){
  11. infoText->append( tr("New connection\n") );
  12. connect( s, SIGNAL(logText(const QString&)),
  13. infoText, SLOT(append(const QString&)) );
  14. connect( s, SIGNAL(connectionClosed()),
  15. SLOT(connectionClosed()) );
  16. }
  17.  
  18. void Form1::connectionClosed(){
  19. infoText->append( tr("Client closed connection\n") );
  20. }
To copy to clipboard, switch view to plain text mode 


When I try to make, I get:

Qt Code:
  1. form1.h:36: error: "ClientConnect" was not declared
To copy to clipboard, switch view to plain text mode 

as if it were an object and not a type. I'm sorry if this question sounds really stupid but I'm a beginner and believe me, I've tried all sorts of things to make it work.