PDA

View Full Version : Potential bug in QwwFileChooser::chooseFile() (of wwWidgets)?



draftpunk
17th November 2009, 17:14
Hello,

I've begun using wwWidgets in a project (great library, by the way :)), and I came across what I think might be a bug. In the QwwFileChooser::chooseFile() function, the case for QFileDialog::ExistingFile seems like it might be missing a break. Here is the code:



case QFileDialog::ExistingFile:
if (d->acceptMode==QFileDialog::AcceptOpen)
path = QFileDialog::getOpenFileName(this, tr("Choose file"), text(), filter());
else
break;


In this case, after getOpenFileName() is called, there is no break, so the following case will also be executed, leading to two file dialogs being displayed, one after the other. Is this the intended behavior, or is it a bug?

Also, there doesn't seem to be a difference between QFileDialog::AnyFile and QFileDialog::ExistingFile (in that they both make the same call to getOpenFileName(). Is this intentional? I realize this is still a work in progress, so I understand if it still needs some "love." :)

I'm using version 0.9.6 of wwWidgets.

Thanks!

wysota
17th November 2009, 17:48
Yes, that's a bug. You should remove the "else" keyword and it should work fine.

There is a difference between AnyFile and ExistingFile. The former will also work in "Save" mode.