Results 1 to 3 of 3

Thread: Problem with QProgressBar

  1. #1
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with QProgressBar

    Hi...
    I am new to QT. I am trying to create an application which reads the data from the database. While retreving the data i want to show the progressbar.
    Since i don't know how much time my application take for retreving the data from different databases, so I m using the busy Progressbar by setting Maximum/Minimum to 0/0.

    Code:

    "void MainWindow::on_Start_button_clicked()
    {
    static int count = 0;
    progressBar->setMaximum(0);
    progressBar->setMinimum(0);
    progressBar->setValue(++count);
    }

    void MainWindow::on_Stop_button_clicke()
    {
    progressBar->reset();
    }
    "

    using the above code I am able to see the busy ProgressBar but on clicking the Stop button I am not able to reset the progressBar... it still keep me showing the busy.

    Please let me know what extra i have to do for resetting the progressBar.

  2. #2
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QProgressBae

    what do you mean by "resetting" ? If you don't change 0-value for min/max, your QProgressBar will never change its behavior (busy indicator).
    If you want to set an empty progress bar, change max to non-0 value and call reset()

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

    agupta (1st January 2011)

  4. #3
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QProgressBae

    Thanks for your reply...
    As per your suggestion i used the following code
    Qt Code:
    1. void MainWindow::on_Stop_button_clicked()
    2. {
    3. progressBar->setMaximum(1);
    4. progressBar->reset();
    5. }
    To copy to clipboard, switch view to plain text mode 

    This code worked fine for me.
    Last edited by wysota; 2nd January 2011 at 13:12.

Similar Threads

  1. Using QProgressBar
    By gutiory in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2010, 07:59
  2. problem in QProgressBar setStyleSheet
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 27th April 2009, 10:03
  3. Problem in QProgressBar update
    By nikhilqt in forum Qt Programming
    Replies: 0
    Last Post: 10th March 2009, 11:20
  4. QProgressBar + Mac OS X
    By THRESHE in forum Qt Programming
    Replies: 5
    Last Post: 14th December 2007, 14:41
  5. QProgressBar & 200%
    By Dmitry in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 12:33

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.