Results 1 to 6 of 6

Thread: QProgressDialog

  1. #1
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QProgressDialog

    Dear Folks,

    I could make QProgessBar dockable into QMainApplication, however, I could not succeed
    in making QProgessDialog dockable into main application. I wonder if QProgresDialog
    can be made dockable, if so, an example would or pointer to it, will be very helpfull.

    regards,

  2. #2
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressDialog

    I'm not sure, if i have understood you correctly. Are you using a QMainWindow and you want to add a QProgressBar dockable in it?

    In designer just make a new QDockWidget, insert a progress bar and set the property "dockable" to true in the property window. Afaik QDockWidget only works in QMainWindow properly.

  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: QProgressDialog

    QDialog is a special widget:
    Note that QDialog (an any other widget that has type Qt::Dialog) uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry.
    So you would have to switch its window type to something else than Qt::Dialog, then you can embed it into a QDockWidget. However, wouldn't QProgressBar be sufficient for you?
    J-P Nurmi

  4. #4
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QProgressDialog

    Thanks for all tips.

    I want to be able to cancel the QProgressBar any time I want to, however, QProgressBar
    does not seem to support 'cancel' operation. So, I came accross QProgressDialog which
    supports "Cancel" operation. However, I could not make QProgressDialog dockable
    into QMainWindow even if I change window type of QProgressDialog to something else.

    I will try again.

    regards,

  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: QProgressDialog

    Here's a small example:
    Qt Code:
    1. // main.cpp
    2. #include <QtGui>
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7. QMainWindow window;
    8.  
    9. QLabel* label = new QLabel("Progressing...", &window);
    10. window.setCentralWidget(label);
    11.  
    12. QDockWidget* dock = new QDockWidget(&window);
    13. QProgressDialog* progress = new QProgressDialog(dock);
    14. progress->setWindowFlags(Qt::Widget); // required to make the dialog a child widget
    15. progress->setRange(0, 0); // to make progress go around forever
    16. dock->setWidget(progress);
    17. window.addDockWidget(Qt::BottomDockWidgetArea, dock);
    18.  
    19. QObject::connect(progress, SIGNAL(canceled()), label, SLOT(clear()));
    20.  
    21. window.show();
    22. return app.exec();
    23. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

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

    toufic.dbouk (12th September 2013)

  7. #6
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QProgressDialog

    Thank you, it was very helpfull, after ProgressDialog is made dockable into main window,
    focus issue, I raised in another thread, is also, resolved.

Similar Threads

  1. How to show QProgressDialog without cancel button
    By rajesh in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2007, 09:53
  2. QProgressDialog and the events
    By chaosgeorge in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2006, 09:22
  3. qprogressDialog
    By mickey in forum Qt Programming
    Replies: 5
    Last Post: 17th July 2006, 14:16
  4. setLabel in QprogressDialog
    By mickey in forum Newbie
    Replies: 5
    Last Post: 12th July 2006, 11:19

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.