
Originally Posted by
jacek
Could you show some code?
Well it's a little long but I show how I use the progress dialog:
FinestraFoto
::FinestraFoto(QWidget *parent
){
(.......)
progres.setRange(0, 3);
progres.setCancelButtonText(0);
progres.setMinimumDuration(0); // I want to show it always
(.........)
}
FinestraFoto::FinestraFoto(QWidget *parent)
: QWidget(parent)
{
(.......)
progres.setRange(0, 3);
progres.setCancelButtonText(0);
progres.setMinimumDuration(0); // I want to show it always
(.........)
}
To copy to clipboard, switch view to plain text mode
That's how I declare ithe progress dialog.
void FinestraFoto::actualitzarFinestra(bool actualitzarFoto, bool actualitzarParamsFitxer,
bool actualitzarParamsRetallat)
{
if (!actualitzarFoto && !actualitzarParamsFitxer && !actualitzarParamsRetallat) return;
progres.setValue(1);
if (actualitzarFoto)
{
tamIniAreaFoto = fotoArea -> maximumViewportSize();
butoEditorFoto
-> setEnabled
(foto
-> fixaFoto
(QImage(pathFoto
).
scaled(tamIniAreaFoto, Qt
::KeepAspectRatio)));
}
progres.setValue(2);
if(actualitzarParamsFitxer)
omplirParamsFitxer();
if(actualitzarParamsRetallat)
omplirParamsRetallat();
progres.setValue(3);
}
void FinestraFoto::actualitzarFinestra(bool actualitzarFoto, bool actualitzarParamsFitxer,
bool actualitzarParamsRetallat)
{
if (!actualitzarFoto && !actualitzarParamsFitxer && !actualitzarParamsRetallat) return;
progres.setValue(1);
if (actualitzarFoto)
{
tamIniAreaFoto = fotoArea -> maximumViewportSize();
butoEditorFoto -> setEnabled(foto -> fixaFoto(QImage(pathFoto).scaled(tamIniAreaFoto, Qt::KeepAspectRatio)));
}
progres.setValue(2);
if(actualitzarParamsFitxer)
omplirParamsFitxer();
if(actualitzarParamsRetallat)
omplirParamsRetallat();
progres.setValue(3);
}
To copy to clipboard, switch view to plain text mode
And that's how I use it everytime "actualitzarFinestra" is called.
then I have 2 subclasses of FinestraFoto where I set the text of the progress dialog for each of them. These subclasses use "FinestraFoto::actualitzarFinestra" method and these widgets are part of the modal dialog. I attach an example of the dialog window, where you can see that these two subclasses correspond with each "image" window. And the progress bars are shown when each image is loaded and each table is filled.
Bookmarks