That's the code for both widgets of the dialog:
This method is to update the contents of the widget:
void ImageWindow::updateWindow()
{
if (fotoValida && taulaValida) return;
QProgressDialog progres
("Carregant imatge i actualitzant informació...",
0,
0,
3,
this);
progres.setMinimumDuration(0);
progres.setValue(1);
if (!fotoValida)
{
butoEditorFoto
-> setEnabled
(foto
-> fixaFoto
(QImage(pathFoto
)/*.scaled(tamIniAreaFoto, Qt::KeepAspectRatio)*/));
fotoValida = true;
}
progres.setValue(2);
if(!taulaValida)
{
omplirParamsFitxer();
omplirParamsRetallat();
taulaValida = true;
}
progres.setValue(3);
}
void ImageWindow::updateWindow()
{
if (fotoValida && taulaValida) return;
QProgressDialog progres("Carregant imatge i actualitzant informació...", 0, 0, 3, this);
progres.setMinimumDuration(0);
progres.setValue(1);
if (!fotoValida)
{
butoEditorFoto -> setEnabled(foto -> fixaFoto(QImage(pathFoto)/*.scaled(tamIniAreaFoto, Qt::KeepAspectRatio)*/));
fotoValida = true;
}
progres.setValue(2);
if(!taulaValida)
{
omplirParamsFitxer();
omplirParamsRetallat();
taulaValida = true;
}
progres.setValue(3);
}
To copy to clipboard, switch view to plain text mode
That's how I reimplement the showEvent:
{
if (!event -> spontaneous())
updateWindow();
}
void ImageWindow::showEvent(QShowEvent *event)
{
if (!event -> spontaneous())
updateWindow();
}
To copy to clipboard, switch view to plain text mode
At the beginning "fotoValida" and "taulaValida" are false, so in the first time that the widgets are shown they update their contents. The problem is that this first update is before the dialog window is shown (painted on screen). That's the real problem detailed in my first post.
Bookmarks