Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Reset Dialog Selected Value
Forum Updated to NodeBB v4.3 + New Features

Reset Dialog Selected Value

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 1.4k Views 1 Watching
  • 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 Offline
    D Offline
    dengineer
    wrote on last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dengineer
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved