Results 1 to 4 of 4

Thread: Show Dialog with Progresbar (Range(0,0)) while Process

  1. #1
    Join Date
    Oct 2015
    Posts
    50
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Show Dialog with Progresbar (Range(0,0)) while Process

    Qt Code:
    1. createDialog();
    2. ...
    3. Dialog->show();
    4. startProcess();
    5. ...
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void CreateDialog(){
    2. Dialog = new QDialog(this);
    3.  
    4. QVBoxLayout *verticalLayout = new QVBoxLayout;
    5. QLabel *DialogLabel = new QLabel;
    6. QPushButton *stopButton = new QPushButton("Stop");
    7. QProgressBar *DialogBar = new QProgressBar;
    8.  
    9. DialogBar->setRange(0,0);
    10. DialogBar->setTextVisible(false);
    11.  
    12. connect(stopButton,SIGNAL(clicked()),this,SLOT(stop()));
    13.  
    14. verticalLayout->addWidget(DialogLabel);
    15. verticalLayout->addWidget(DialogBar);
    16. verticalLayout->addWidget(stopButton);
    17.  
    18. Dialog->setWindowTitle(tr("Bitte Warten"));
    19. DialogLabel->setText(tr("Starten Sie das Gerät neu. \nEs wird nach einem Gerät gesucht..."));
    20.  
    21. Dialog->setLayout(verticalLayout);
    22. Dialog->window()->layout()->setSizeConstraint(QLayout::SetFixedSize);
    23. Dialog->setModal(true);
    24.  
    25. Dialog->installEventFilter(this);
    To copy to clipboard, switch view to plain text mode 

    I have a Dialog which i show while I search for my Device (sending Data to port, if there is no answer: send again, if there is an answer: close the dialog, a button can interrupt the search).

    While this Search I want the user to see the Progressbar so he knows that something is happening. It was working but then i changed the code and too late I realised that it isn't working anymore.

    The progressbar is empty and does nothing, only when I click on the dialog and move it I can wake it up but then of course the process does not go on.
    I would call QApplication:rocessEvents() to wake up the progressbar but I am not setting the value of the progressbar or anything like that, so i do not know where I should call it.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Show Dialog with Progresbar (Range(0,0)) while Process

    How do you advance the progress bar value?
    Does startProcess() block the thread?

    Cheers,
    _

    P.S. there is QProgressDialog in case you haven't found it already

  3. #3
    Join Date
    Oct 2015
    Posts
    50
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Show Dialog with Progresbar (Range(0,0)) while Process

    I do not advance the value of the progress. Just setrange(0,0) and it showed me continiously running progressbar once.

    What do you mean by blocking the thread? Everything is working in one thread. I am able to click the button to interrupt the function, so I do not think that there is anything blocked.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Show Dialog with Progresbar (Range(0,0)) while Process

    Quote Originally Posted by mikrocat View Post
    I do not advance the value of the progress. Just setrange(0,0) and it showed me continiously running progressbar once.
    That's strange, i've always had to change the value, e.g. with a timer if the processing function doesn't know about the progress bar/dialog

    Quote Originally Posted by mikrocat View Post
    What do you mean by blocking the thread? Everything is working in one thread. I am able to click the button to interrupt the function, so I do not think that there is anything blocked.
    Right, being able to click the button is a good indicator that the thread is not blocked.

    Cheers,
    _

Similar Threads

  1. Show an indicator icon after a heavy process
    By qt_developer in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2013, 22:14
  2. How to show dialog(only .ui)
    By ditsikts in forum Newbie
    Replies: 1
    Last Post: 23rd October 2011, 14:51
  3. Show dialog application lunched as a process.
    By mourad in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2008, 13:27
  4. Show dialog in the task bar
    By bruccutler in forum Newbie
    Replies: 4
    Last Post: 23rd May 2007, 22:52
  5. Replies: 3
    Last Post: 16th November 2006, 12:24

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.