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

    ! Box)!

    @BoxSelectionDialog {
    id: selectionArrivalDialog
    onAccepted :{
    itemArrivalSelection.text = model.get(selectedIndex).name;
    arrivalId = model.get(selectedIndex).trainId;
    if(arrivalId != null)
    {arrivalClear.visible= true;

                            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...

    ! Box After)!
    This is what I have now to reset the values:

               @     onClicked: {
                        itemArrivalSelection.text="-- Arriving At? (Optional) --"
                        arrivalClear.visible= false;

    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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.