Results 1 to 4 of 4

Thread: How to use QEventLoop?

  1. #1
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question How to use QEventLoop?

    The app I'm creating is relative to the network.I want it to check if the username/password is valid when it starts.And while validating,nothing can the user do.I also want to make the UI responsible.So I think of QEventLoop(I guess that's what I need,right?)

    Here,I use validate() to check the info.
    Qt Code:
    1. bool MyApp::validate()
    2. {
    3. QString requestURL = "http://xxxxxx.com/check?username=aaa&password=bbb";
    4. QNetworkReply* reply= manager.get(QNetworkRequest(requestURL));
    5. ....
    6. }
    To copy to clipboard, switch view to plain text mode 

    HOW do I use QEventLoop inside the validate(),so that I can return ture/false,when the server tells me whether the info is correct.
    It's not the goodbye that hurts,but the flashback that follow.

  2. #2
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use QEventLoop?

    I'm not sure I understand your question, wont some sort of modal login (dialog) box achieve this?

    You may want to have a look at Wysota's login box http://www.wysota.eu.org/wwwidgets/
    Got to keep the loonies on the path ...

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to use QEventLoop?

    You don't need QEventLoop. Just set the enabled property of your GUI window to false while sending the request and enable it back again in the slot connected to the signal emitted when the response arrives.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use QEventLoop?

    Thanks,both of you enlighten me~I was a little stubborn at this point.ha
    It's not the goodbye that hurts,but the flashback that follow.

Similar Threads

  1. QThread and QEventLoop - Idle Processing
    By kloffy in forum Newbie
    Replies: 14
    Last Post: 28th April 2011, 11:41
  2. qprocess or qeventloop
    By knishaq in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2009, 10:14
  3. static QEventLoop strange behavior
    By SABROG in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 12:04
  4. Discard user input events in QEventLoop.
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2006, 20:49

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.