[SOLVED] how to reset the combobox to its default state?
-
in the qt designer, i have added some items to the combobox. when the user selects an item from the combobox, i would like that item to be deselected and to display the first item at the top of the combobox again. i am asking if there is a way to reset the combobox back to its default state.
-
if i understand it correctly , you are looking for setCurrentIndex ( int index ). That is, after every selection, the combobox shows the particular item, instead of the selected item.
And if you reset this way with value -1 , the selection will be none. -
[quote author="kalster" date="1323577768"]no. you miss understand Volker, and Andre. the user selects and item in the combobox and the event is triggered. after the event, the combobox is reset to the default state. that is what i am trying to do.[/quote]
I understood it exactly this way and I stand that this is a horrible UI design. I as a user would be upset.
If I needed such a functionality, I would go with a context menu or a [[Doc:QToolButton]] with a menu. That looks more suitable for what you want to do and does not fool the user.
-
i have two comboboxs, one is for the user name and the other is for the user locations. when a different user name is selected, the user location combobox needs to change. i was asking how to change the user location but i understand how now.
i would agree that this is a bad ui design if i was using one combobox but i am using two comboboxs to function together.