[Qt-interest] Problem with getExistingDirectory....Please advise

Srdjan Todorovic todorovic.s at googlemail.com
Tue May 12 11:04:50 CEST 2009


Hi,

2009/5/12 Usman Ajmal <uzmanajmal at gmail.com>:
> Thank you very much Thiago...
>
> One more favor....am getting following error:
>
> error: no matching function for call to
> ‘MyFileDialog::getExistingDirectory(Ui::MainWindow* const, const char [23],
> QString, bool)’
> filedialog.h:41: note: candidates are: static QString
> MyFileDialog::getExistingDirectory(QWidget*, const char*, const QString&,
> bool, bool)

Ui_MainWindow is more like a panter. It's not an actual dialog. It
creates the widgets and adds them to a dialog.

Consider:
   QDialog dlg;
   Ui_MainWindow dialogPainter;

   dialogPainter.setup(&dlg);

The dialogPainter sets up the dialog's widgets on the supplied dialog.
(Yes dialogPainter might not be a very good name for this.)

> I know what the error says i.e. i have to use QWidget but don't know how to
> resolve it. Following are the snippets of code...

Best way is to stop treating Ui_MainWindow as a dialog. Have a look at
the produced header to see what it does.

Good luck,

Srdjan




More information about the Qt-interest-old mailing list