Results 1 to 2 of 2

Thread: Synchronizing input and storage for settings

  1. #1
    Join Date
    Jul 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Synchronizing input and storage for settings

    Setting up a UI for settings and saving/loading settings via QSettings (http://qt-project.org/doc/qt-4.8/qsettings.html) are simple, but what is good practice for keeping these synchronized, e.g. populating the input fields with settings loaded, or saving when inputs change?
    Input handling has to be done for verification anyway, so this may take care of saving data.
    But for the other way around - is there some kind of standard list that could be iterated over to retrieve settings and write them to the respective user input? But this would need to be abstracted further and also keep track of the data type to choose the correct setters...

    Further abstraction may use a settings tree (e.g. registry or Qt Creator Property Editor) which does away with a manual layout for input Widgets (I found older information on/implementation of this http://qtnode.net/wiki/Creating_Models_from_Scratch and http://doc.qt.digia.com/solutions/4/...ser/index.html). This approach is probably the most flexible, although maybe not acceptable for some end users. Possibly, a custom view could set up the UI in a similar fashion to the manual layout with labels and group boxes etc.

    How do you do it?

    PS:
    All old links to this add-on refer to the Nokia site and are redirected to qt-project.org/ where this is not caught. I seem to have found the repositories for the add-ons: http://qt.gitorious.org/qt-solutions...ropertybrowser

    This even features the "custom" view I was thinking about above.

    License in header of http://qt.gitorious.org/qt-solutions...rtybrowser.cpp :
    /************************************************** **************************
    **
    ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    ** All rights reserved.
    **
    ** Contact: Nokia Corporation (qt-info@nokia.com)
    **
    ** This file is part of a Qt Solutions component.
    **
    ** You may use this file under the terms of the BSD license as follows:
    **
    ** "Redistribution and use in source and binary forms, with or without
    ** modification, are permitted provided that the following conditions are
    ** met:
    ** * Redistributions of source code must retain the above copyright
    ** notice, this list of conditions and the following disclaimer.
    ** * Redistributions in binary form must reproduce the above copyright
    ** notice, this list of conditions and the following disclaimer in
    ** the documentation and/or other materials provided with the
    ** distribution.
    ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
    ** the names of its contributors may be used to endorse or promote
    ** products derived from this software without specific prior written
    ** permission.
    **
    ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    **
    ************************************************** **************************/
    Last edited by fruchtquark; 28th November 2012 at 15:23.

  2. #2
    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: Synchronizing input and storage for settings

    What is the actual question? QSettings should be all you need in this particular case unless I don't understand what you mean.
    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.


Similar Threads

  1. Replies: 7
    Last Post: 27th April 2012, 13:17
  2. Replies: 3
    Last Post: 18th May 2011, 16:56
  3. synchronizing events
    By zaphod.b in forum Qt Programming
    Replies: 0
    Last Post: 14th July 2009, 16:29
  4. Synchronizing QFtp
    By arun_vj in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 12:31
  5. Synchronizing two GraphicsScenes
    By manojmka in forum Qt Programming
    Replies: 13
    Last Post: 3rd December 2007, 09:59

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.