Unsolved QFileDialog get IFileDialog interface on Windows?
-
Is there a way to get the IFileDialog interface from the QFileDialog widget on windows? We current use MFC and the CFileDialog but we grab the IFileDialog interface to add a couple of custom controls and add some application specific favorites to the tree.
If not I guess I could use the IFileDialog interface directly, but the convenience functions of the QFileDialog are easier to use so I'd rather use that.
-
It's not possible.
-
Hi,
Depending on what you are doing maybe setSidebarUrls might do the trick.
-
@SGaist Yeah I don't like that universal dialog. I was looking for a way to modify the native Windows dialog like this...
See how we have custom favorites under the program name on the left? And the "Recent Folders" drop down at the bottom next to Open?
On Windows you do that by getting access to the IFileDialog interface. With MFC you can get that from the CFileDialog wrapper. But apparently not possible with QFileDialog. Oh well, guess I'll use IFileDialog directly.
I assume there is any easy way to have code that runs on one platform only? (I'm still really new to Qt, so just figuring this stuff out)
-
@Dan203 said in QFileDialog get IFileDialog interface on Windows?:
I assume there is any easy way to have code that runs on one platform only?
See https://doc.qt.io/qt-5/qmake-language.html#scopes : using scopes you can compile platform specific source files for the specific platform. Using scopes you can also set a define which you can check in C++ code:
win32:DEFINES += USE_MY_STUFF
then in C++
#ifdef USE_MY_STUFF // This will only be compiled if USE_MY_STUFF is set #endif
-
@jsulm said in QFileDialog get IFileDialog interface on Windows?:
@Dan203 said in QFileDialog get IFileDialog interface on Windows?:
I assume there is any easy way to have code that runs on one platform only?
See https://doc.qt.io/qt-5/qmake-language.html#scopes : using scopes you can compile platform specific source files for the specific platform. Using scopes you can also set a define which you can check in C++ code:
win32:DEFINES += USE_MY_STUFF
then in C++
#ifdef USE_MY_STUFF // This will only be compiled if USE_MY_STUFF is set #endif
Thanks!
-
You can also use Qt's platform defines:
#ifdef Q_OS_WIN
so no need for more custom defines.