Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Reset Dialog Selected Value

    Mobile and Embedded
    1
    2
    1244
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dengineer last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • D
        dengineer last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post