Hello, guys
I want to make my Qt embedded app work as client-server architecture,
a QApplication that start with "-qws" or create with "QApplication::GuiServer" would play as a server, and the others QApplication the create with "QApplication::GuiClient" play as a client.

start the server app first, and then start the client app.

the problems is:
1. In server code, I set the max window rect to QRect(100, 100, 400, 300) via QWSServer::setMaxWindowRect();
In server application, the rect of widget_1 is QRect(100, 100, 400, 300), that is correct.
But in client app, the label_2 show full screen. I think this is wrong.
if I use QWSServer::setMaxWindowRect in client app, the max rect of label_2 is ok.

2. I connect the qws window event signal to my custom slot, and debug the window name, the server widget_1(QWidget) come into this slot, but I don't see the label_2(QLabel) come.

It seems that the client application play as a server itself, not a client of my server app, so the client doesn't respond to the server.

what is going wrong with my code ?

see code below:

server code:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication app(argc, argv, QApplication::GuiServer);
  4. Server srv;
  5.  
  6. QWidget widget_1;
  7. widget_1.showMaximized();
  8.  
  9. return app.exec();
  10. }
  11.  
  12. #ifndef _SERVER_H_
  13. #define _SERVER_H_
  14.  
  15. class Server : public QObject
  16. {
  17. Q_OBJECT
  18.  
  19. public:
  20. Server(QObject *parent = NULL);
  21. ~Server();
  22.  
  23. Q_SIGNALS:
  24.  
  25. public Q_SLOTS:
  26.  
  27. protected:
  28.  
  29. private Q_SLOTS:
  30. void windowEventHandler(QWSWindow *, QWSServer::WindowEvent);
  31.  
  32. private:
  33. QWSServer *server;
  34. };
  35.  
  36. #endif // _SERVER_H_
  37.  
  38. Server::Server(QObject *parent)
  39. : QObject(parent)
  40. {
  41. // init qws server
  42. server = QWSServer::instance();
  43. QWSServer::setMaxWindowRect(QRect(100, 100, 400, 300));
  44. connect(server, SIGNAL(windowEvent(QWSWindow*, QWSServer::WindowEvent)),
  45. this, SLOT(windowEventHandler(QWSWindow*, QWSServer::WindowEvent)));
  46. }
  47.  
  48. Server::~Server()
  49. {
  50.  
  51. }
  52.  
  53. void Server::windowEventHandler(QWSWindow *window, QWSServer::WindowEvent eventType)
  54. {
  55. qDebug() << "Server::windowEventHandler" << window->name();
  56. }
To copy to clipboard, switch view to plain text mode 

client code:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication app(argc, argv, QApplication::GuiClient);
  4.  
  5. QLabel label_2;
  6. label_2.showMaximized();
  7.  
  8. return app.exec();
  9. }
To copy to clipboard, switch view to plain text mode