Results 1 to 3 of 3

Thread: QProgressDialog and forceShow(), how to use this protected member?

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QProgressDialog and forceShow(), how to use this protected member?

    Hello, i got a problem with QProgressDialog, i'd like to show quickly the QProgressDialog but i get this error:
    Qt Code:
    1. /usr/local/Trolltech/Qt-4.3.2-commercial-static/include/QtGui/qprogressdialog.h:101: error: ‘void QProgressDialog::forceShow()’ is protected
    To copy to clipboard, switch view to plain text mode 
    here down the code
    Qt Code:
    1. QProgressDialog progress ( tr ( "Sending configuration..." ) , tr ( "Abort" ) , 0 , commandNumber , this );
    2. progress.setWindowTitle ( tr ( "Sending configuration..." ) );
    3. progress.setWindowModality ( Qt::NonModal );
    4. progress.setMinimumDuration(0);
    5. progress.forceShow(); // <-- error forceShow() is protected
    To copy to clipboard, switch view to plain text mode 
    thx

  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: QProgressDialog and forceShow(), how to use this protected member?

    That's right, it's protected and not intended to be called like that. Did you read what QProgressDialog::forceShow() does? Just set minimum duration to 0.
    J-P Nurmi

  3. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProgressDialog and forceShow(), how to use this protected member?

    ok I read, but my bar isn't showed, i post whole the code, maybe i have some error in
    Qt Code:
    1. QProgressDialog progress ( tr ( "Sending configuration..." ) , tr ( "Abort" ) , 0 , commandNumber , this );
    2. progress.setWindowTitle ( tr ( "Sending configuration..." ) );
    3. progress.setWindowModality ( Qt::NonModal );
    4. progress.setMinimumDuration(0);
    5.  
    6. for ( int i=0 ; i < commandNumber ; i++ )
    7. {
    8. QApplication::processEvents();
    9.  
    10. // set the progress bar
    11. progress.setValue ( i );
    12.  
    13. // check if user choose to abort operation
    14. if ( progress.wasCanceled () )
    15. {
    16. return false;
    17. }
    18. }
    19.  
    20. progress.setValue ( commandNumber );
    To copy to clipboard, switch view to plain text mode 
    edit:
    i checked again, it works
    Last edited by mattia; 22nd January 2008 at 16:01.

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.