Results 1 to 10 of 10

Thread: saving files for future use on different computers running the same application

  1. #1
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question saving files for future use on different computers running the same application

    I would like the ability for my application to save the layout and contents of the layouts when the user clicks save in my application. I would like the application to save them when the user clicks save. I would also like the user to have the ability to move to a different machine and run the application and load the file they saved. And when loaded, their layouts would all appear with the contents of those layouts.

    How can i do this? And what would be the easiest and most proper way to do this? Right now, i am using DOM and just saving everything to a xml file. However, i just feel like there must be a different and easier way to do this. Can someone please enlighten me?

    Thanks in advance, any comments and help is greatly appreciated!

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: saving files for future use on different computers running the same application

    You could also use QSettings..

  3. The following user says thank you to Santosh Reddy for this useful post:

    prolink007 (13th June 2011)

  4. #3
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: saving files for future use on different computers running the same application

    Could you give me an example of how that would work. I took a look at the documentation and i really need a little bit of an example to go with it, have any examples at hand? Or is anyone able to show me an example of what i need using the settings?

    If anyone has any other ideas on a way to accomplish what i want, please say so. Thanks!

  5. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: saving files for future use on different computers running the same application

    If you want an example how to use the QSettings the documentation gives it.

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

    prolink007 (13th June 2011)

  7. #5
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: saving files for future use on different computers running the same application

    Well from what i am seeing from that document is that it is going to load these settings into the registry. I need this stuff saved to a file that can be carried with the person to other machines running the application. Settings does not seem to offer this.

    Before i asked this question i have been using DOM and xml stuff to save all the layout types and their contents and just loading all that when the user clicks load file and selects their file. But it just seems like there would be an easier way.

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: saving files for future use on different computers running the same application

    Quote Originally Posted by prolink007 View Post
    Settings does not seem to offer this.
    Sure it does.

    Before i asked this question i have been using DOM and xml stuff to save all the layout types and their contents and just loading all that when the user clicks load file and selects their file. But it just seems like there would be an easier way.
    You can use QMainWindow::saveState() and QWidget::saveGeometry() and their counterparts to get rid of some of the work.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. The following user says thank you to wysota for this useful post:

    prolink007 (13th June 2011)

  10. #7
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: saving files for future use on different computers running the same application

    Ok, so if the user inputs data into an edit text box, some of QSettings methods should be able to handle saving this information?

    I am looking through the documentation and i must be missing the part where i can save this to a file specified by the user. For instance, the user just got through creating some tabs in their layout and then input some data into edit text boxes on those tabs (all within mainwindow). Now they want to save the layout and contents of what they just input to a file. They click save and then go to a different computer and want to load that stuff there. How is QSettings going to do this? I just keep seeing it doing stuff with the registry.

    Sorry, i am just really confused. I am going to read it some more, but if you have input i would greatly appreciate further assistance! =)

  11. #8
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: saving files for future use on different computers running the same application

    You can tell QSettings to input/output from an external file.

  12. The following user says thank you to SixDegrees for this useful post:

    prolink007 (13th June 2011)

  13. #9
    Join Date
    Apr 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: saving files for future use on different computers running the same application

    Using this: QSettings::QSettings ( const QString & fileName, Format format, QObject * parent = 0 )

    Is it that simple or is there something else?

  14. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: saving files for future use on different computers running the same application

    It is that simple.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. The following user says thank you to wysota for this useful post:

    prolink007 (13th June 2011)

Similar Threads

  1. Problem when saving bmp files
    By cdlaweed in forum Newbie
    Replies: 3
    Last Post: 17th March 2011, 10:20
  2. Application crash when saving the image
    By Astrologer in forum Qt Programming
    Replies: 1
    Last Post: 10th May 2010, 10:52
  3. Running exe files
    By Luc4 in forum Qt Programming
    Replies: 0
    Last Post: 4th March 2010, 21:29
  4. Running flash .swf files in widget?
    By ashukla in forum Qt Programming
    Replies: 37
    Last Post: 12th February 2008, 05:14
  5. Running application on Mac OS X
    By munna in forum General Discussion
    Replies: 1
    Last Post: 19th April 2006, 21:10

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.