Solved Change QComboBox value
-
Our combox value contain some values like100, 200, 300 now i select 200 and lclose window then again open this window now our combobox index value is 200... how to do it please explain
-
@Rameshguru
I think you are looking for this http://doc.qt.io/qt-4.8/qsettings.html
how to useQSettings
doc https://wiki.qt.io/How_to_Use_QSettings
and http://stackoverflow.com/questions/28600271/saving-combination-of-qspinbox-and-qcombobox-using-qsettings
This may help too http://www.qtcentre.org/threads/7984-Using-QSettings-to-populate-a-QComboBox -
When you close the window you need to store which item was selected earlier. You can use some thing called current index which is property of your combo box. Read current index in qcombobox documentation. When you open the window again use setcurrentindex method to the index which you saved. Look at currentindexchanged signal as well in qcombobox. If you want close the application completely and restart again look at option of qsetting as suggested in prev post
-
@dheerendra
thank you sir -
@Rameshguru if issue is resolved can you move it to solved state