Results 1 to 7 of 7

Thread: prolem with threadedfortuneserver using QMainWindow instread dialog

  1. #1
    Join Date
    Dec 2013
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default prolem with threadedfortuneserver using QMainWindow instread dialog

    Hi I am new qt programming, I tried to use threadedfortune example it works fine but, when I replace the dialog class by QMainWindow (ui) the program doesn't work?
    any idea I did not change the code of fortuneserver.* and fortunethread.*, I just repace dialog.* by ui.*
    when I run it, it seems connected but not responding
    any help thanks.


    void ui::runserver()
    {
    QHostAddress hostadd("127.0.0.1");
    if (!server.listen(hostadd,20000)) {
    cout<<"Threaded Fortune ServerUnable to start the server: %1."<<server.errorString().toStdString()<<endl;
    close();
    return;
    }

    cout<<server.serverAddress().toString().toStdStrin g()<<" at port "<<server.serverPort()<<endl;
    }
    Attached Files Attached Files
    • File Type: cpp ui.cpp (847 Bytes, 5 views)
    • File Type: h ui.h (822 Bytes, 3 views)

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    What do you mean with "it seems connected"?
    Do you get your log output?

    Cheers,
    _

  3. #3
    Join Date
    Dec 2013
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    I meant that the server listening but not responding to the client request, in fact when I run the client and a ask for a new fortune, the push button becomes disable, I guess the incomingConnection function doesn't responde to the client request.!!!

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    The you probably have to debug that FortuneServer class of yours.

    I am already puzzled that you got it to listen, runserver() doesn't seem to be called in the code you've posted.

    Cheers,
    _

  5. #5
    Join Date
    Dec 2013
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    I call the runserver function via a pushbutton which written in ui_ui.h file .

    connect(runserverButton, SIGNAL(clicked()), this, SLOT(runserver()));

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    Right, that was to be expected. But since that is not part of the code you posted it means that the code is not what you are actually using.

    I am not sure why you are asking for help while not providing enough information to do so.

    Cheers,
    _

  7. #7
    Join Date
    Dec 2013
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: prolem with threadedfortuneserver using QMainWindow instread dialog

    It works know, I think I did a mistake somewhere I attached also my code. Thanks a lot for trying to help me.
    Attached Files Attached Files

Similar Threads

  1. Replies: 4
    Last Post: 25th August 2014, 18:05
  2. Replies: 3
    Last Post: 13th November 2011, 08:12
  3. How to close QMainWindow and open login dialog
    By keeyias in forum Qt Programming
    Replies: 3
    Last Post: 15th October 2009, 12:33
  4. Replies: 9
    Last Post: 13th August 2008, 18:07
  5. Modal dialog in QMainWindow's event() function
    By tanminh in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2007, 09:46

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.