Results 1 to 7 of 7

Thread: Config files best practices

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2015
    Location
    Vermont
    Posts
    52
    Qt products
    Qt5
    Platforms
    MacOS X Windows
    Thanks
    15
    Thanked 1 Time in 1 Post

    Default Re: Config files best practices

    That wouldn't work so well for us as the applications are pretty much never called via the command line. The users of the applications are general retail employees so they click on the .exe file to run it, and when in development I build and run them in Qt Creator.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Qt products
    Qt5
    Platforms
    MacOS X
    Thanks
    13
    Thanked 153 Times in 150 Posts

    Default Re: Config files best practices

    I was thinking more along the lines of desktop icons that passed the appropriate command line arguments, i.e. "Foo Prod", "Foo Develop", etc. but if that doesn't work for you, then obviously it's not a good choice...

    Good luck!
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Config files best practices

    Perhaps you could use a QSettings INI-type file to store your environment flag. The app looks for the file (and flag entry) at startup, and if it finds it, it uses that mode. Otherwise, it goes to the default mode (production, presumably). You'll only need the QSettings file on your development / testing machine, not on the machines deployed to users.

    By the way, a year or two ago I posted code here that provides a QSettings interface to XML files. You might find it easier to use for your user-side XML config files.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    ce_nort (31st August 2016)

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Config files best practices

    Quote Originally Posted by ce_nort View Post
    That wouldn't work so well for us as the applications are pretty much never called via the command line. The users of the applications are general retail employees so they click on the .exe file to run it, and when in development I build and run them in Qt Creator.
    That wouldn't be a problem as far as I can tell.

    If the application is started without arguments, it just uses the default path or default file name.

    If you run in QtCreator you can easily pass arguments as part of the run settings.

    Another option is to use an environment variable or even have both options, one overriding the other if both are present.

    Cheers,
    _

  6. The following user says thank you to anda_skoa for this useful post:

    ce_nort (31st August 2016)

  7. #5
    Join Date
    Nov 2015
    Location
    Vermont
    Posts
    52
    Qt products
    Qt5
    Platforms
    MacOS X Windows
    Thanks
    15
    Thanked 1 Time in 1 Post

    Default Re: Config files best practices

    Sounds like there are a few good options out there! Thanks for the ideas. I'll look into them and decide what will work best for us, they all sound like a potential improvement upon the approaches that we came up with.

Similar Threads

  1. What are best practices for QSS files?
    By danielvianna in forum Newbie
    Replies: 0
    Last Post: 25th September 2015, 17:26
  2. Make Config files unreadable
    By mrandreas in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2011, 00:53
  3. Replies: 2
    Last Post: 9th October 2010, 05:34
  4. Creating pkg-config files
    By zarq in forum Installation and Deployment
    Replies: 0
    Last Post: 6th May 2010, 11:53
  5. Best practices concerning QStandardItemModel
    By tim47 in forum Qt Programming
    Replies: 2
    Last Post: 27th January 2010, 05:29

Tags for this Thread

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.