UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    OptionSelector problem

    Scheduled Pinned Locked Moved App Development
    1 Posts 1 Posters 471 Views 1 Watching
    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.
      • M Offline
        Mick21367
        last edited by

        Hi,
        I've had a problem with the OptionSelector on the LocalRadio app ever since I introduced filters. Basically, if I select one of the filters (say BBC Local Radio) and then select one of the stations from the OptionSelector, the OptionSelector then displays a different station - even though the app plays the correct station. Some of the other stations display a blank instead. Does anyone have any idea where I'm going wrong? The code for the filter and OptionSelector are below:-
        // This is the filter I apply to limit the results shown in os1

            ListModel {
               id: filterModel
            ListElement {
               name: "Radio"
               }
            ListElement {
               name: "BBC National Radio"
               }
            ListElement {
               name: "BBC Local Radio"
               }
            ListElement {
               name: "BBC International Radio"
               }
            ListElement {
               name: "Independant National Radio"
               }
            ListElement {
               name: "Independant Local Radio"
               }	
            } 
        

        // Filter OptionSelector

         OptionSelector {
                id: os2
                containerHeight: units.gu(90)
                width: parent.width
                model: filterModel
                onClicked: view.model.reload(filter)
                }
        

        // this is the List shown in the Channel OptionSelector

             XmlListModel {
                id: model
                source: "src/stations.xml"
                query: "/stations/station"
                  XmlRole { name: "index"; query: "index/string()"}
                  XmlRole { name: "type"; query: "type/string()" }
                  XmlRole { name: "name"; query: "name/string()" }
                  XmlRole { name: "link"; query: "link/string()" }
                  XmlRole { name: "play"; query: "play/string()" }
                  XmlRole { name: "icon"; query: "icon/string()" }
                  }
            SortFilterModel {
                id: sortedRadio
                model: model
                filter.property: "type"
                filter.pattern: new RegExp(filter.text)
                }
        

        // this is the Channel Selector

           OptionSelector {
               id:os1
               containerHeight: 300 - units.gu(1)
               model: if (favText.text==1) {
                          favourites
                      } else {
                          sortedRadio
                      }
               delegate: OptionSelectorDelegate { text: name; subText: type}
           }
        

        Thanks
        Mick

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post