LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-22-2014, 09:40 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 536

Rep: Reputation: 42
QT combobox how to save list position


Hi All,
I've been learning QT buy setting up a demo form to fill in. I can save the answer boxes in a file and reload the answers from a file. However I've now hit a snag.
Basically I've added combo boxes, with a number of items in the drop down list. I'd like to store the selection the user has made and when they load in a file have the combobox pointing to that item in the list.
So say I have a list
"Lubuntu"
"Ubuntu"
"Debian"
"Kbuntu"
and the user chooses item 3 Debian, how can I save the position and then on loading up a file start at position "Debian" rather than "Lubuntu"

Thanks for the advise
 
Old 03-22-2014, 01:43 PM   #2
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,676

Rep: Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441
http://qt-project.org/doc/qt-4.8/qco...rentIndex-prop

You call currentIndex() to get the current selection, and save that. When you've loaded it from the file, you call setCurrentIndex() to restore the selection.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mplayer window position save? cleansugar Linux - Software 1 10-31-2013 06:47 PM
howto change column order in list of partitions in combobox in krusader ? masuch Linux - Newbie 0 10-20-2012 02:44 PM
BASH Sort list by end of line to x position in each line? SilversleevesX Programming 14 08-19-2010 08:30 PM
save position & desktop of multiple xterms in Fluxbox esteeven Linux - General 7 05-12-2005 02:50 PM


All times are GMT -5. The time now is 11:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration