Results 1 to 2 of 2

Thread: How to load file when program opens

  1. #1
    Join Date
    Mar 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default How to load file when program opens

    I created a unique file extension, and I want the user to be able double click on their saved file and the program automatically opens and loads it. How do I do that?

    I imagine this would use the argv value in main? But I have no idea how it would be done.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    62
    Thanked 260 Times in 246 Posts

    Default Re: How to load file when program opens

    The file extension you must "register" from the OS to open with your program (i don't know how you can done this from your application - maybe the installers have some options for that, since the installer knows where the user installs your application) and then the double clicked file name (and path) will be sent by the OS using the arguments (int argc is the number of arguments and char** argv are the argument strings, also QCoreApplication has functionality that returns arguments in a QStringList (the first argument is the exe name and path).

Similar Threads

  1. Call to QDialog opens 2 windows
    By rdjenner in forum Newbie
    Replies: 5
    Last Post: 14th August 2010, 01:54
  2. Dialog opens twice
    By ulmly in forum Qt Programming
    Replies: 9
    Last Post: 30th June 2009, 20:25
  3. Statically linked program doesn't load QImage from file.
    By badjer1024 in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2009, 19:45
  4. Shell opens when start Qt app
    By giusepped in forum Qt Programming
    Replies: 15
    Last Post: 2nd February 2009, 07:20
  5. Replies: 2
    Last Post: 13th September 2006, 10:11

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
  •  
Qt is a trademark of The Qt Company.