Does QFileOpenEvent supported on Windows? If no, how can I achieve it?
-
I am currently developing an application on Windows, but my deployment target is to be cross-platform. I know that I can sub-class
QApplication
and override itsevent
method to detect theQFileOpenEvent
, but the docs said that this class works on macOS only. So what's the method to detect the similar features on Windows (and even better, Linux/X11)?I know someone had raised a Qt Bug (for example #2222) but it seems no one has commented on the bug and fixed it.
For your reference, after I had built the detection mechanism by using the
QStringList QCoreApplication(int &argc, char *argv[]).arguments()
method, Windows file managerexplorer.exe
starts a whole new process that is independent from the already-has(ve)-opened window(s) processes, resulting in a whole new sub-classedQApplication
instance inducingqApp->closeAllWindows()
only closes a part of all the opened windows which theoretically all should be treated as a single application.I once thought that this was impossible as the Kate text editor by KDE, which also uses the Qt, has also encountered the exactly same problem. I am still wondering if this is possible.
Any help will be greatly appreciated! Thanks.
-
If you want only a single instance of your application running you should take a look at QtSingleApplication