[Qt-interest] How to embed QfileDialog in Custom Dialog

Alexis Ménard alexis.menard at trolltech.com
Mon Jan 5 18:42:06 CET 2009


Santhosh Y wrote:
> Hi,
>
> I want to embed QFileDialog in cDialog(custom dialog)
>
> Please suggest me to do that.
>
> I am trying to do in the following way, but before dialog is shown 
> QFileDialog is being shown.
> How to avoid that - It should be part of my cDialog
>
>
>     QDialog* cDialog  = new QDialog(lnHandler);
>     cDialog->setWindowTitle ("Customized");
>
>     QStringList filesForImport = QFileDialog::getOpenFileNames(cDialog,
>             dialogHeader,
>             ds.value(Settings::AbsPath, "").toString(),  // Reading
>             tr(fileFilter));
>     ds.endGroup();
>     cDialog->show ();
>
>   
Like this you use the native dialog so if you run windows or mac then
the native dialog will be show and you can't embed it into a custom
dialog. Try this option at the end of getOpenFileNames (see doc)
DontUseNativeDialog.

If it doesn't work then you have to construct a standard QFileDialog
like new QFileDialog instead of using the static functions.

-- 
Alexis Ménard
Software Engineer, Widgets Team 1
Qt Software, Nokia Norge AS, Sandakerveien 116, 0484 Oslo, Norway



More information about the Qt-interest-old mailing list