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. How to allow open two or more instances of an application?
QtWS25 Last Chance

How to allow open two or more instances of an application?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 2.6k 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.
  • MufanM Offline
    MufanM Offline
    Mufan
    wrote on last edited by
    #1

    Hi!

    I have an application written with Qt Creator 4.6.1 (Based on Qt 5.10.1).
    When I have this application launched and make another double click on the application icon, the first instance (which is already launched) shows.
    Is it possible to set some flags or do something and be able to open another instance?

    Thanks a lot!
    Serge

    JonBJ 1 Reply Last reply
    1
    • MufanM Mufan

      Hi!

      I have an application written with Qt Creator 4.6.1 (Based on Qt 5.10.1).
      When I have this application launched and make another double click on the application icon, the first instance (which is already launched) shows.
      Is it possible to set some flags or do something and be able to open another instance?

      Thanks a lot!
      Serge

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @Mufan
      Normally each launch would create a separate instance (try it in a simple app test). Does the code already have something which prevents that? Google for qt application multiple instances and you'll see people discussing what might be done to prevent them.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        What platform are you running on ?

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

        MufanM 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          What platform are you running on ?

          MufanM Offline
          MufanM Offline
          Mufan
          wrote on last edited by
          #4

          @SGaist
          Hi! I'm running on MacOS.

          @JonB
          I don't use "lock unique files" or QSystemSemaphore methods to prevent this. That should be something else.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mpergand
            wrote on last edited by mpergand
            #5

            On Mac, the Finder doesn't allow users to launch multiple instances of the same app.

            Work around:

            • Duplicate the app with a different name.
            • With the Terminal, use open command with the path of the executable in the app bundle folder, like that:
              open AppName.app/Contents/MacOS/AppName
            1 Reply Last reply
            4

            • Login

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