ComboBox not saving selection
-
I have an issue similar to this post: https://forum.qt.io/topic/88519/editable-combobox-not-saving-edited-text/2
Where after I make a selection in the dropdown, if I scroll out of view and then back into view, the selection reverts back to the previous selection. I have these combo boxes in a scrollable TableView which apparently reloads elements every time they come back into view. Also, my ComboBox is not editable but I just want to be able to save the new selection I make.
I know I need to handle onAccepted, but I am not sure how to save the new value I select into the current selection that gets displayed if I leave the view then come back to it. I have 2 methods like this:onDisplayTextChanged: { console.log("currentText in onDisplayTextChanged: " + currentText) onAccepted() } onAccepted: { console.log("currentText in onAccepted: " + currentText) }
I use onDisplayTextChanged to receive the new value selected that I can pass to a Python script in the future, before calling onAccepted because onAccepted does not trigger for some reason after I click on a new selection. So if my currentText is already the text on the new selection, then how can I save that as the current selection that does not disappear after a simple view change like scrolling out of view then back into view?