Open the file in the same instance of the application



  • I have written an application in Qt where it reads an xml file (file with diagrams and scene). I had registered the extension to open with my application on double clicking in Windows.
    This file would open a new tab (which is a feature of the application. So I could open several files together in tabs. This behaviour seemed to have disappeared. Now each time I double click on the file it opens a new instance. The difference I noticed when I upgraded to 5.7.0 (Sorry but during the several upgrades might have missed which upgrades had this broken).

    Not sure if this is a setting in Qt which can be triggered back. Windows OS questions seem like this has to be baked within the application since the OS does not handle this.

    If I need to provide more information please let me know. I hope I have framed the question correctly.

    Thanks in advance.


  • Moderators

    @vivian Are you sure it was working before as you described?
    Actually you have to implement this in your app. I don't think Qt ever supported this without additional implementation.
    There is something you can use for this: https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication



  • @vivian Yea that should never have worked without you adding in support for it.

    You need a singleton application like @jsulm posted. Then you need to handle getting the filename via the shell and code it to open a new tab.

    That's really odd that ever worked before. It's certainly not part of Qt.


Log in to reply