OptionSelector problem
-
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 os1ListModel { 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