import QtQuick 2.0 import Sailfish.Silica 1.0 ValueButton { id: channelSelect property var channels: null property int currentChannel: -1 property bool _channelsAvailable: channels && channels.length enabled: _channelsAvailable value: (_channelsAvailable ? currentChannel>=0 ? (currentChannel+1)+": "+channels[currentChannel] : "0: (off)" : "(not available)") onClicked: { if(_channelsAvailable) pageStack.push(selectDialog); } Component { id: selectDialog Page { id: page function selectChannel(index) { channelSelect.currentChannel = index; pageStack.pop(); } SilicaFlickable { width: parent.width contentHeight: column.height Column { id: column width: parent.width spacing: Theme.paddingLarge PageHeader { id: header title: channelSelect.label } ChannelItem { channelIndex: 0 channelName: "(off)" down: channelSelect.currentChannel+1==channelIndex onClicked: page.selectChannel(channelIndex-1); } Repeater { id: repeater model: channelSelect.channels ChannelItem { channelIndex: index+1 channelName: modelData down: channelSelect.currentChannel+1==channelIndex onClicked: page.selectChannel(channelIndex-1); } } } } } } }