PDA

View Full Version : Help with QComboBox



the9gamer
5th August 2012, 13:43
Hello

in the main windows I use a text file to get the values for the QComboBox
but I also have slots that modify this same file
when I return to the main window the values don't changes
How can I proceed to update the values in the QComboBox

and thank you;

galrub
5th August 2012, 18:08
Hello,
if I get your question right, there are two method that I might think of:

1) reload the combobox; call clear() and refill the combo's values.
2) iterate over the combos values and check if the new value exist; using count() to get the size of values in the combo and then loop through them searching one by one.

hope it helps

the9gamer
5th August 2012, 22:09
it's a paiement program
first you select the company with QComboBox
but if you want to add a new company you push the botton new
wich take the data of the new company and save them into the file that containt all companies
it is the same file that QComboBox use to get it's values
but when add successfully your new company and return to the main window
the values in the QComboBox are the same

I hope that this describe the situation properly

And thank you

saman_artorious
8th August 2012, 07:36
but when add successfully your new company and return to the main window
the values in the QComboBox are the same

I hope that this describe the situation properly

And thank you

R u sure you read the file (hope) each time before reloading the contents of QComboBox?
did you debug the file reading operation to make separately to make sure it works fine?
paste your file reading and combo box loading function here, so that we could find the problem.