Results 1 to 4 of 4

Thread: Qt client/server architecture doesn't work for my embedded linux platform

  1. #1
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Qt client/server architecture doesn't work for my embedded linux platform

    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 

  2. #2
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: Qt client/server architecture doesn't work for my embedded linux platform

    and something I need to mention is I running Qt-4.5.3 on a arm-linux platform,
    for Qt performance, I had most of Qt feature disabled.
    Is this could be the problem?

    see my qconfig file attached.

    /WX
    Attached Files Attached Files

  3. #3
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: Qt client/server architecture doesn't work for my embedded linux platform

    1. I also tried QProcess to start my client app, got the same result.

    2. I testing the QCopChannel communication. It is ok if two channel object in the same QApplication(process), but if I create the channels in different QApplication(process), they can not receive each other.

    So, it sound like that QCopChannel are broken by something ?

    /WX
    Last edited by wesley; 14th August 2010 at 02:28.

  4. #4
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: Qt client/server architecture doesn't work for my embedded linux platform

    OK, after looking the fucking source code, I found that this is because I disable the QWS MultiProcess feature in my qconfig file.

    It seems that the Qt maybe unstable if I disable lots of features.
    Could somebody please help me to check my qconfig file(attached in this thread), and found out if any critical Qt kernel features are disabled?

    Thanks....

    /WX

Similar Threads

  1. QT ActiveX server doesn't work with Delphi 7.0
    By _AK_ in forum Qt Programming
    Replies: 2
    Last Post: 24th August 2016, 05:55
  2. QT 4.5 Embedded Linux Demo Web Browser does not work
    By saltuka in forum Qt Programming
    Replies: 1
    Last Post: 1st November 2010, 04:11
  3. Replies: 7
    Last Post: 7th June 2010, 14:13
  4. why on Linux ,doesn't work?
    By maider in forum Qt Programming
    Replies: 5
    Last Post: 11th March 2010, 08:57
  5. Client/Server doesn't work
    By mattia in forum Newbie
    Replies: 2
    Last Post: 1st November 2007, 13:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.