Results 1 to 7 of 7

Thread: Open multiple files with one program instance

  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    514
    Thanks
    12
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Open multiple files with one program instance

    Hi, I want to select multiple files in Windows explorer and open them (by pressing Enter) with the same program instance.
    For now I can open one file this way, but if I select multiple files, I get the same number of instances of my program, and each of these instances opens one file.

    Is there a way to achieve the "all files - one instance" goal with Qt mechanisms, or do I have to use a native API?
    If the latter, any ideas for what I'd have to search? A short search brought "dde" up, is this right?

    Thanks in advance,

    Ginsengelf

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Open multiple files with one program instance

    maybe I didn't understand properly what you need, but did you see QFileDialog::getOpenFileNames method?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Open multiple files with one program instance

    Have a look at QtSingeApplication and the article at the wiki (I think there was one...)
    Last edited by Lykurg; 16th March 2009 at 13:19. Reason: spelling error

  4. The following user says thank you to Lykurg for this useful post:

    Ginsengelf (16th March 2009)

  5. #4
    Join Date
    Feb 2009
    Posts
    79
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open multiple files with one program instance

    I don't know the exact solution, but generally your problem splits in two sub problems:

    A) Only open ine instance of your program at a time

    B) give an open instance of you program an external command to open a certain file

    DDE sounds good, I used this with Latex some time ago...

  6. #5
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    514
    Thanks
    12
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Open multiple files with one program instance

    Quote Originally Posted by Lykurg View Post
    Have a look at QtSingeApplication and the article at the wiki (I this there was one...)
    Amazing reaction time

    The QtSingleApplication looks like something I can use, thanks. In the wiki there's an just article about the Singleton pattern (or maybe I missed the correct one).

    Ginsengelf

  7. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Open multiple files with one program instance

    Quote Originally Posted by Ginsengelf View Post
    (or maybe I missed the correct one).
    short answer: yes!

    Long answer: Look here: Data_Sharing and SingleApplication


    Lykurg

  8. #7
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    514
    Thanks
    12
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Open multiple files with one program instance

    Indeed... it is listed under "Categories -> Tutorials" on the left, but I just looked over the wiki main page where it is not listed

Similar Threads

  1. Replies: 12
    Last Post: 17th June 2009, 05:34
  2. Multiple project files in a single directory
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 17th July 2008, 07:03
  3. i want to open programs from my program!
    By coder1985 in forum Qt Programming
    Replies: 3
    Last Post: 4th January 2008, 09:45
  4. Replies: 5
    Last Post: 29th October 2007, 22:49
  5. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.