Reset Dialog Selected Value
-
Hi, This is my first post. I tried looking at documentation and online forums but can' seem to figure a couple of things out. For now, can someone tell me how to reset the Selected value in a dialog box?
So currently I have a dialog box
!http://nextbart.info/images/selected.png(Selected Box)!
@BoxSelectionDialog {
id: selectionArrivalDialog
onAccepted :{
itemArrivalSelection.text = model.get(selectedIndex).name;
arrivalId = model.get(selectedIndex).trainId;
if(arrivalId != null)
{arrivalClear.visible= true;
departingMouseArea.width=358;
}} onRejected: {arrivalId = -1;} }
@
I call the rejected signal and the value arrivalId is being set from say 4 (4th item) to -1 (no item) , but I can't figure out how to reset the selected value. The next time I open the dialog box the previous box is selected...
!http://nextbart.info/images/selected2.png(Selected Box After)!
This is what I have now to reset the values:@ onClicked: { itemArrivalSelection.text="-- Arriving At? (Optional) --" arrivalClear.visible= false; console.log(arrivalId) selectionArrivalDialog.reject() console.log(arrivalId) arrivalMouseArea.width=449; }@
I tried several things but there must be an a non c++ way to reset the actual dialog.
-
Found a Solution:
@selectedIndex = -1;@
The new problem now is that the list is starting from the last item selected, even though the selectedIndex of -1 means nothing is selected.