Results 1 to 6 of 6

Thread: QStatusBar and QProgressBar

  1. #1
    Join Date
    Oct 2008
    Location
    Brasil - São Paulo - Marília
    Posts
    28
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    3

    Default QStatusBar and QProgressBar

    Hi all.

    I'm wish to add a QProgressBar to a QStatusBar in QMainWindow. But it must not be visible all the time.

    I'm using a code similar to this and can't get it to work

    Qt Code:
    1. Form::Form(QWidget* parent): QMainWindow(parent)
    2. {
    3. progress = new QProgressBar(this);
    4. progress->setVisible(false);
    5.  
    6. statusbar->addPermanentWidget(progress);
    7. }
    8.  
    9. Form::showProgress(bool visible)
    10. {
    11. progress->setVisible(visible);
    12. }
    To copy to clipboard, switch view to plain text mode 

    Any ideas???

    Thanks in advance!

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStatusBar and QProgressBar

    You need to hide progress bar again, when your task is completed or when progress value reaches at highest range.

  3. #3
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QStatusBar and QProgressBar

    Quote Originally Posted by yogeshgokul View Post
    You need to hide progress bar again, when your task is completed or when progress value reaches at highest range.
    Yup. I agree with @yogeshgokul. You have to hide it or disable it when your process is completed.

  4. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QStatusBar and QProgressBar

    status bar is having the option of removing and adding a QWidget ... u can use that one also ..
    "Behind every great fortune lies a crime" - Balzac

  5. #5
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStatusBar and QProgressBar

    Quote Originally Posted by wagmare View Post
    status bar is having the option of removing and adding a QWidget ... u can use that one also ..
    I think he is using same
    Qt Code:
    1. statusbar->addPermanentWidget(progress);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Oct 2008
    Location
    Brasil - São Paulo - Marília
    Posts
    28
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    3

    Default Re: QStatusBar and QProgressBar

    Hi all.

    I solve the problem with the following code:

    Qt Code:
    1. progress->setVisible(visible);
    2. qApp->processEvents();
    To copy to clipboard, switch view to plain text mode 

    Thanks for the help!!!

Similar Threads

  1. Embedding QProgressBar in QStatusBar: Height issues
    By elahav in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 14:39

Tags for this Thread

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.