Results 1 to 4 of 4

Thread: Refreshing problem

  1. #1
    Join Date
    Aug 2006
    Posts
    5
    Thanks
    1

    Default Refreshing problem

    Hello, I'm having some problems when I try to repaint() a window.
    I'm using signals and in the slot function I'm printing the values I send to it, and I can see values like 5, 10, 15,20,25... etc, but the QProgressBar I pass to those values only appears some times, like 15, 35, 70... the others seem to get lost due to refreshing problems.
    This happens when I load a file and make some (many) operations and I emit a signal every 5% completed. But only some of these values appears in the ProgressBar.
    It happens algo with the entire window (the menu's) doesn't refresh while I'm doing the loading of the file.
    So.. there is some way to force the repainting of a window? or to force the completition of the signals?

    Thanks

    Jaime

  2. #2
    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: Refreshing problem

    Try calling
    Qt Code:
    1. qApp->processEvents();
    To copy to clipboard, switch view to plain text mode 
    once in a while during the long lasting operation. See QProgressDialog's Detailed description for explanation.
    J-P Nurmi

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

    jaime (24th August 2006)

  4. #3
    Join Date
    Aug 2006
    Posts
    5
    Thanks
    1

    Default Re: Refreshing problem

    It worked! Thanks!

    I read many tutorials of the qt-webpage but I didn't find this, what source for information would be good for qt-developing? Maybe a web or some book?
    I'm newbie in this topic

    Thanks a lot

    Jaime

  5. #4
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Refreshing problem

    Just the documentation is usually enough to figure out how something works. For example, if you look at the documentation for QProgressDialog, under Detailed Description, you will find:

    Using a modal QProgressDialog is simpler for the programmer, but you must call QApplication::processEvents() or QEventLoop::processEvents(ExcludeUserInput) to keep the event loop running to ensure that the application doesn't freeze.

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.