How to automatically change the options in a second combobox based on the option chosen(output) in the first combobox.
Added after 27 minutes:
I want the answer in python
How to automatically change the options in a second combobox based on the option chosen(output) in the first combobox.
Added after 27 minutes:
I want the answer in python
Last edited by Aasikaa; 25th July 2018 at 09:59.
by connecting the first comboxes currentIndexChanged(int) signal to the second ones setCurrentIndex(int) slot
That works if you want the items with the same indexes to be chosen in each combobox. I think what the OP means is that the second combobox will be filled with a different list of items based on what was chosen in the first box.
The more general solution is to write a slot that listens for the currentIndexChanged() signal. In that slot, you clear the second combobox and fill it with the correct items for whatever index was chosen in the first combobox.
If I were to do this in python, I would create a list of lists; the first list would be index numbers from 0 to whatever. For each entry in that list, it would contain a sub-list of the entries for the second combobox. In the slot, you retrieve the sub-list for the index that was selected, and use it to fill the second combobox.
If you can't hard-code the second combobox lists, then you'll have to use some other means to look up or retrieve the second list based on the first index.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Thank you. will try these
Bookmarks