Results 1 to 20 of 35

Thread: busy progress bar without thread ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    Qt Code:
    1. ui.initStatus->setMaximum(0);
    2. ui.initStatus->setMinimum(0);
    3. this->timer = new QTimer(this);
    4. connect(this->timer, SIGNAL(timeout()), this, SLOT(advanceProgressBar()));
    5. this->timer->start(100);
    6.  
    7. void advanceProgressBar(){
    8. qApp->processEvents();
    9. }
    To copy to clipboard, switch view to plain text mode 

    Don't work

    how...
    thanks!!
    Last edited by jpn; 4th December 2008 at 19:06. Reason: missing [code] tags

  2. #2
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    the bar does not move!
    don't increment...it is stopped

  3. #3
    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: busy progress bar without thread ?

    Works for me:
    Qt Code:
    1. // main.cpp
    2. #include <QtGui>
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7. QProgressBar progressBar;
    8. progressBar.setMinimum(0);
    9. progressBar.setMaximum(0);
    10. progressBar.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  4. #4
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    Quote Originally Posted by jpn View Post
    Works for me:
    Qt Code:
    1. // main.cpp
    2. #include <QtGui>
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7. QProgressBar progressBar;
    8. progressBar.setMinimum(0);
    9. progressBar.setMaximum(0);
    10. progressBar.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    Don't work... see

    Qt Code:
    1. QApplication app(argc, argv);
    2. QMainWindow window;
    3. QProgressBar* progressBar = new QProgressBar(&window);
    4. progressBar->setMaximumHeight(16);
    5. progressBar->setMaximumWidth(200);
    6. progressBar->setTextVisible(false);
    7. progressBar->setMaximum(0);
    8. progressBar->setMinimum(0);
    9.  
    10. progressBar->show(); // ??? don't move the bar
    11.  
    12. window.statusBar()->addPermanentWidget(progressBar);
    13. window.statusBar()->showMessage("Loading");
    14. window.show();
    15. app.exec();
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 4th December 2008 at 19:31. Reason: missing [code] tags

  5. #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: busy progress bar without thread ?

    Which Qt version are you using? I recall seeing a bug in the past that with some specific style that you had to set a value != 0 to make the busy indicator to work.
    J-P Nurmi

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

    bmn (4th December 2008)

  7. #6
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    I am using Qt4

  8. #7
    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: busy progress bar without thread ?

    Quote Originally Posted by bmn View Post
    I am using Qt4
    Well, that's not very exact definition. The first version of Qt 4 was released a few years ago. There have been quite a few minor and patch version upgrades since then. What is the exact version eg. 4.x.y? Which style are you using? You can see the bug situation in the task-tracker.
    J-P Nurmi

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

    bmn (4th December 2008)

  10. #8
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    Quote Originally Posted by jpn View Post
    Well, that's not very exact definition. The first version of Qt 4 was released a few years ago. There have been quite a few minor and patch version upgrades since then. What is the exact version eg. 4.x.y? Which style are you using? You can see the bug situation in the task-tracker.
    QMake version 2.01a
    Using Qt version 4.2.1 in /usr/lib/qt4/lib

  11. #9
    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: busy progress bar without thread ?

    Quote Originally Posted by bmn View Post
    QMake version 2.01a
    Using Qt version 4.2.1 in /usr/lib/qt4/lib
    The current stable version of Qt is 4.4.3. Probably it's time to upgrade. Anyway, have you tried the trick setting the value to something != 0? And again, which style you are using?
    J-P Nurmi

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

    bmn (4th December 2008)

  13. #10
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    Quote Originally Posted by jpn View Post
    The current stable version of Qt is 4.4.3. Probably it's time to upgrade. Anyway, have you tried the trick setting the value to something != 0? And again, which style you are using?
    Default Style
    this is the test
    Qt Code:
    1. int main(int argc, char *argv[]){
    2. QApplication app(argc, argv);
    3. QMainWindow window;
    4. QProgressBar* progressBar = new QProgressBar(&window);
    5. progressBar->setMaximumHeight(16);
    6. progressBar->setMaximumWidth(200);
    7. progressBar->setTextVisible(false);
    8. progressBar->setMaximum(0);
    9. progressBar->setMinimum(0);
    10. progressBar->setValue(1); // ??? don't move the bar
    11. window.statusBar()->addPermanentWidget(progressBar);
    12. window.statusBar()->showMessage("Loading");
    13. window.show();
    14. app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 4th December 2008 at 19:57. Reason: missing [code] tags

  14. #11
    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: busy progress bar without thread ?

    First of all, could you finally start using appropriate [code] tags, please? I already sent instructions to you.

    Secondly, the "default style" depends on the environment. The following piece of code prints out which style is the default style for you:
    Qt Code:
    1. qDebug() << app.style()->objectName();
    To copy to clipboard, switch view to plain text mode 
    You can try different styles by passing it as a command line argument:
    bash Code:
    1. ./myapp -style windows
    To copy to clipboard, switch view to plain text mode 
    You can try different styles like "windows", "plastique", "cleanlooks" etc. Does any of them work?
    Last edited by wysota; 2nd January 2009 at 23:20.
    J-P Nurmi

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

    bmn (4th December 2008)

  16. #12
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: busy progress bar without thread ?

    Quote Originally Posted by jpn View Post
    First of all, could you finally start using appropriate [code] tags, please? I already sent instructions to you.

    Secondly, the "default style" depends on the environment. The following piece of code prints out which style is the default style for you:
    Qt Code:
    1. qDebug() << app.style()->objectName();
    To copy to clipboard, switch view to plain text mode 
    You can try different styles by passing it as a command line argument:
    bash Code:
    1. ./myapp -style windows
    To copy to clipboard, switch view to plain text mode 
    You can try different styles like "windows", "plastique", "cleanlooks" etc. Does any of them work?
    Sorry i will start to use code!!

    My default style is cleanlooks, change to windows and WORKS, but, only with windows style.
    I will try to set windows style as default
    thanks!!
    Last edited by wysota; 2nd January 2009 at 23:21.

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

    Default Re: busy progress bar without thread ?

    It works for me in Qt 4.5.1's QProgressBar.

    Just set progressBar.setMinimum(0); progressBar.setMaximum(0); in the designer works for me. The progressBar.value would be -1 automatically in designer.

    Hope this helps.

Similar Threads

  1. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  2. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02
  3. Replies: 11
    Last Post: 7th July 2006, 13:09
  4. [QT4] QThread and printing a QList<QPixmap>
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 21:44
  5. Replies: 2
    Last Post: 6th January 2006, 21:15

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.