Results 1 to 7 of 7

Thread: qpushbutton not disabling properly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: qpushbutton not disabling properly

    The shortest possible way to solve the problem is to add a call to QCoreApplication::processEvents().
    Qt Code:
    1. void RoboSearch::listFiles()
    2. {
    3. searchButton->setEnabled(false);
    4. // let the application process its events
    5. QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    6. //code is searching through files, so it takes ~5s
    7. searchButton->setEnabled(true);
    8. }
    To copy to clipboard, switch view to plain text mode 
    5s is a long time for a GUI application to be frozen so you might want to call the same method every now and then during the search.
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    abrou (23rd February 2008)

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
  •  
Qt is a trademark of The Qt Company.