Yes, I know, one should not mix different platforms, but I am working on a Qt application and now we have a new requirement: a standard Windows Open File Dialog should be used in place of a QFileDialog.
So I would like to create a CFileDialog that is a child of a QWidget. I have found a question related to the inverse problem: QWidget as a child of an existing MFC component but nothing about my specific issue.
My plan is to write a wrapper class
class FileStdWDialog : CFileDialog
with a constructor
FileDirStdWDialog(QWidget *parent, ...);
and map this to a call to the superclass constructor
CFileDialog(..., ..., ..., ..., ..., CWnd* pParentWnd, ...)
So, if I understand correctly, my problem boils down to mapping
a QWidget * to a CWnd *. Do you know if there is an easy way to do this?
Update
Thanks for the hints. Probably, getting the HWND for a QWidget and
converting this to CWnd * is the right solution. I will try this way.
You could call
::GetOpenFileNameand::GetSaveFileName. Those are the Win32 functions thatCFileDialogwraps, I think. So you wouldn’t need MFC.By the way, starting with Windows Vista, it is recommended to use the Common Item Dialog, rather than the standard Open and Save dialogs.