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. Open a File from Explorer in my Qt application
Forum Update on Monday, May 27th 2025

Open a File from Explorer in my Qt application

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.5k 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.
  • M Offline
    M Offline
    maxwell31
    wrote on 26 Apr 2020, 08:26 last edited by aha_1980
    #1

    Hi,

    My application is writing files. I would like to open such a file in my application, if it is clicked on in the Windows explorer. For this, I think once I have to set open with to my application. If I understand it correctly, my application is then called with the file name as argument.

    Is it also possible to open a file in an already running instance of my application (it is possible to have several files open at once)

    Thanks!

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 26 Apr 2020, 08:28 last edited by
      #2

      You could 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
      3
      • M Offline
        M Offline
        maxwell31
        wrote on 26 Apr 2020, 17:25 last edited by
        #3

        Ok, interesting. Still, how could I load a file in my running application via a click on a file in the Windows explorer? Is there a slot which gets called automatically?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 26 Apr 2020, 17:29 last edited by
          #4

          Hi,

          If you mean associate your application with your custom file type then you have to configure your OS for that.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M Offline
            M Offline
            maxwell31
            wrote on 26 Apr 2020, 18:31 last edited by
            #5

            Hi SGaist,

            Yes, thats what I mean. But once I have associated a file type with my application, what happens next? Does e.g. Windows (which will be the main target platform, although we also support Linux) simply call my application executable (and gives it the file name as argument?) or is there a more complicated mechanism?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              maxwell31
              wrote on 26 Apr 2020, 18:33 last edited by SGaist
              #6

              Now that I know its called associating I found this:
              https://wiki.qt.io/Assigning_a_file_type_to_an_Application_on_Windows

              1 Reply Last reply
              1
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 26 Apr 2020, 18:36 last edited by
                #7

                Nice ! Thanks for sharing your finding !

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                7/7

                26 Apr 2020, 18:36

                • Login

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