PDA

View Full Version : probabily probme with QFileDIalog



mickey
25th August 2006, 21:58
hi, hi coded this:


void mainform::save() {
file = QFileDialog::getOpenFileName(ref,
" (*.xml)\n"
" (*.ler)\n"
"All Files (*.xml; *.ler)",
NULL,
this,
"open file dialog",
tr("Choose a filename to open under"));
Working work(this);
doManyThings()
work.close();
}
It happen that when I save the qfiledialog leave an umbra on my app (you can see the pic); the same for work dialog (you can see this worst)....I don't understand: I'd like that when I click on save in QfileDialog it go away and THEN 'doManyThings()' is execute...but happen that the umbra of QFileDIalog disappear only when doManyThings() is executed completely. Can anyone help me? thanks

jacek
25th August 2006, 22:58
" (*.xml)\n"
" (*.ler)\n"
"All Files (*.xml; *.ler)",
You should use ";;" instead of "\n".


that the umbra of QFileDIalog disappear only when doManyThings() is executed completely.
That's because you block the event loop --- use QApplication::processEvents().

mickey
31st August 2006, 11:38
hi,
your hint for QFIledialog was OK! But with a dialog create in designer this doens't work!!! what change?? thanks (usually the umbra of initPlainDialog is visible until all this instructions aren't exectute)...


void MainForm::fileNew()
{
initPlainDialog *initpd= new initPlainDialog();
if(initpd->exec()){
int vx = initpd->IPDSpinBoxX->value();
int vy = initpd->IPDSpinBoxY->value();
if ((vx > 0 && vy > 0) && (vx*vy <=1024)) {
qApp->processEvents();
doSOmething //very long time
widget1->update(); //long time
}

jacek
31st August 2006, 12:17
doSOmething //very long time
This blocks the event loop, so you must call QApplication::processEvents() inside it, for example in every iteration.