Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ComboBox not saving selection
Forum Updated to NodeBB v4.3 + New Features

ComboBox not saving selection

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 181 Views
  • 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.
  • S Offline
    S Offline
    SCP173
    wrote on last edited by
    #1

    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?

    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