Show Dialog with Progresbar (Range(0,0)) while Process
Code:
createDialog();
...
Dialog->show();
startProcess();
...
Code:
void CreateDialog(){
DialogBar->setRange(0,0);
DialogBar->setTextVisible(false);
connect(stopButton,SIGNAL(clicked()),this,SLOT(stop()));
verticalLayout->addWidget(DialogLabel);
verticalLayout->addWidget(DialogBar);
verticalLayout->addWidget(stopButton);
Dialog->setWindowTitle(tr("Bitte Warten"));
DialogLabel->setText(tr("Starten Sie das Gerät neu. \nEs wird nach einem Gerät gesucht..."));
Dialog->setLayout(verticalLayout);
Dialog
->window
()->layout
()->setSizeConstraint
(QLayout::SetFixedSize);
Dialog->setModal(true);
Dialog->installEventFilter(this);
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::processEvents() 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.
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
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.
Re: Show Dialog with Progresbar (Range(0,0)) while Process
Quote:
Originally Posted by
mikrocat
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
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,
_