Results 1 to 10 of 10

Thread: How show progress of slow a operation?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    15
    Thanks
    1

    Default How show progress of slow a operation?

    I need to show the progress of a slow operation , but I doesn´t have a loop to set the values for a qprogressdialog.
    I have only a call to a method compute(); but I don´t have get access to his internal code.

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How show progress of slow a operation?

    I believe threading is your only option then:
    http://doc.qt.nokia.com/4.6/threads.html

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How show progress of slow a operation?

    throw compute() into a seperate thread, and then do some animation until the thread returns.

  4. #4
    Join Date
    Jul 2009
    Posts
    15
    Thanks
    1

    Default Re: How show progress of slow a operation?

    but , the thread can pass or set the value of the q?progressdialog?

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How show progress of slow a operation?

    No, you set the volume of the progress dialog in your main gui loop using a timer.

  6. #6
    Join Date
    Jul 2009
    Posts
    15
    Thanks
    1

    Default Re: How show progress of slow a operation?

    Ok, but my problem is that the operation sometimes is fast (depending of his entries) and other times is very slow , so predefined a time is very difficult.

  7. #7
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How show progress of slow a operation?

    QProgressDialog supports marquee style which just moves the progess back and forth to show that something is happening but it is unknown how long it will take.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How show progress of slow a operation?

    The thread will send you a signal when it is completed, so you can remove the progress bar. Therefore it doesn't matter if the task takes long time or short time.

  9. #9
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How show progress of slow a operation?

    Quote Originally Posted by fatjuicymole View Post
    The thread will send you a signal when it is completed, so you can remove the progress bar. Therefore it doesn't matter if the task takes long time or short time.
    If I understand shud correctly, then the 'volume' is unknown, so in that case it is better to make the progressbar go back and forth - imho.

  10. #10
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How show progress of slow a operation?

    Quote Originally Posted by schnitzel View Post
    If I understand shud correctly, then the 'volume' is unknown, so in that case it is better to make the progressbar go back and forth - imho.
    Yes, and I completely agree with you, but you still need to remove that progress bar when the task is finished, hence why I mentioned using the signal that the thread object will send when the thread completes execution.

Similar Threads

  1. Show progress of a time consuming operation
    By rainman110 in forum Newbie
    Replies: 7
    Last Post: 10th February 2008, 12:07
  2. change of ownershiip operation not permaitted while build
    By quickNitin in forum Installation and Deployment
    Replies: 5
    Last Post: 16th May 2006, 12:13
  3. Not show the progress bars under another window
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 13th March 2006, 17:22

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.