Results 1 to 3 of 3

Thread: Persistent combobox entries.

  1. #1
    Join Date
    Mar 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    1

    Default Persistent combobox entries.

    I have a file browse button which displays a QFileDialog. On selecting a file I add the path to an editable combobox. What I want is a way to make all these entries persistent so that these are available in the combobox drop down the next time when the dialog is invoked? Does Qt have a preference framework for controls.

  2. #2
    Join Date
    Apr 2009
    Posts
    36
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 7 Times in 6 Posts

    Default Re: Persistent combobox entries.

    Take a look at QSettings: http://qt.nokia.com/doc/4.6/qsettings.html. You could iterate over the items in the combo box and add them to the application settings.

    Edit: I forgot to add that you'll need to save it at the close of your application and then restore them when the application opens.

  3. #3
    Join Date
    Apr 2009
    Posts
    36
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 7 Times in 6 Posts

    Default Re: Persistent combobox entries.

    I forgot to add that if you just want this persistent over the life of the application and not between application sessions, then the easiest thing to do is to save the combo box information in a QList somewhere in your program and access it again when you instantiate the QComboBox widget.

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

    spsingh (11th March 2010)

Similar Threads

  1. QLineEdit persistent selection
    By elmo in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2009, 13:15
  2. Combobox entries filter as I type
    By yazwas in forum Qt Programming
    Replies: 3
    Last Post: 8th August 2009, 14:04
  3. Persistent widgets in QTableView.
    By kaushal_gaurav in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2008, 20:06
  4. Replies: 2
    Last Post: 18th March 2008, 15:38
  5. Help using the QTreeWidget persistent editor.
    By Billy Lee Black in forum Qt Programming
    Replies: 13
    Last Post: 18th July 2007, 19:59

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.