Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Does QFileOpenEvent supported on Windows? If no, how can I achieve it?

Does QFileOpenEvent supported on Windows? If no, how can I achieve it?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qfileopeneventwin-fileopenargvnon-macosqcoreapplicatio
2 Posts 2 Posters 235 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JackMyson
    wrote on 14 Apr 2024, 07:53 last edited by
    #1

    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 its event method to detect the QFileOpenEvent, 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 manager explorer.exe starts a whole new process that is independent from the already-has(ve)-opened window(s) processes, resulting in a whole new sub-classed QApplication instance inducing qApp->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.

    C 1 Reply Last reply 14 Apr 2024, 08:08
    0
    • J JackMyson
      14 Apr 2024, 07:53

      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 its event method to detect the QFileOpenEvent, 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 manager explorer.exe starts a whole new process that is independent from the already-has(ve)-opened window(s) processes, resulting in a whole new sub-classed QApplication instance inducing qApp->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.

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 14 Apr 2024, 08:08 last edited by
      #2

      If you want only a single instance of your application running you should take a look at QtSingleApplication

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      1/2

      14 Apr 2024, 07:53

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved