Results 1 to 4 of 4

Thread: Generating Customized project files in Qt

  1. #1
    Join Date
    Sep 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Generating Customized project files in Qt

    Hi ,

    In my Current requirement i would like to create a a customized project file which my application can load in future.The project file will be specific to my application only .It will contain all the paths of the created components as items represent unique directory.There will be loading of some other tools from my application which will also generate some files and there record is also to be maintained in my project file.This project file can be loaded also by my application.

    I could use QSettings way , but the problem is the file extension of QSettings file will be either .ini or .conf, as compared to my project file extension which will be let say .amu.

    I can do this also using XML way.But can any body suggest some other goof way to achieve this functionality.

    Thanks.
    Last edited by Raghaw; 19th March 2015 at 05:05.

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

    Default Re: Generating Customized project files in Qt

    Why do you care what the file extension is for your application settings?

    If you really want to use your .amu file extension and have control over the contents/format of the settings, you can read/write the contents yourself using either serialized Qt objects, XML, JSON, or any other format you wish. If you decide to do this, then the responsibility is yours to manage the contents/format of the data.

    I would suggest that you use QSettings with the QSettings::NativeFormat, which would be standard for the OS type your application is running on. This would also allow users to edit your application settings using the native OS tools like Xcode plist editor on Mac, a text editor for INI files, or regedit for Windows applications.

    You can of course choose to reinvent the wheel, it's just not clear why you would want to do this.

    Edit: You could also use a database like SQLITE to store all of these settings. If your app already uses a database, then adding a settings or preferences table would be trivial to implement. With SQLITE, you can also name the file whatever you want, so you could use the .amu file type as well.

    Regards,

    Jeff

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

    Default Re: Generating Customized project files in Qt

    Quote Originally Posted by Raghaw View Post
    I could use QSettings way , but the problem is the file extension of QSettings file will be either .ini or .conf, as compared to my project file extension which will be let say .amu.
    Doesn't QSettings have a constructor that lets you pass a filename?

    Cheers,
    _

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Generating Customized project files in Qt

    You might also look at this post where I posted code that implements serialization of QSettings using XML. You can use any QIODevice-based storage, so if you use a file, you can name it anything you want.

Similar Threads

  1. Replies: 10
    Last Post: 15th March 2013, 23:48
  2. Replies: 2
    Last Post: 30th September 2010, 12:26
  3. Replies: 2
    Last Post: 5th September 2010, 14:26
  4. Generating Xcode project does not work
    By schall_l in forum Qt Tools
    Replies: 0
    Last Post: 13th February 2010, 13:33
  5. Generating Log files
    By srohit24 in forum Qt Programming
    Replies: 12
    Last Post: 15th July 2009, 07:57

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.