Commit 70cfdc07 authored by Sergey Chupligin's avatar Sergey Chupligin Committed by Aleksi Suomalainen

[SelectRoller] create delegate property

parent e94290d9
......@@ -45,6 +45,28 @@ Page {
clip: true
model: animalsModel
label: qsTr("Choose your favorite animal")
delegate:Text{
height: simpleRoller.itemHeight
text: name
color: "white"
font.pixelSize: 32
font.bold: (simpleRoller.active && ListView.view.currentIndex === index)
MouseArea{
anchors.fill: parent
onClicked: {
if(!simpleRoller.active)
{
simpleRoller.active = true;
}
else
{
simpleRoller.currentIndex = index
simpleRoller.active = false
}
}
}
}
}
GlacierRoller {
......@@ -58,5 +80,27 @@ Page {
clip: true
model: animalsModel
label: qsTr("Choose your second favorite animal")
delegate:Text{
height: simpleRoller2.itemHeight
text: name
color: "white"
font.pixelSize: 32
font.bold: (simpleRoller2.active && ListView.view.currentIndex === index)
MouseArea{
anchors.fill: parent
onClicked: {
if(!simpleRoller2.active)
{
simpleRoller2.active = true;
}
else
{
simpleRoller2.currentIndex = index
simpleRoller2.active = false
}
}
}
}
}
}
......@@ -4,6 +4,7 @@ Item {
id: glacierRoller
property alias model : view.model
property alias label: label.text
property alias delegate: view.delegate
property int currentIndex: -1
property int activateSize: 5
......@@ -80,30 +81,11 @@ Item {
anchors{
verticalCenter: view.verticalCenter
}
}
delegate:Text{
id: listItem
//width: parent.width
height: itemHeight
text: name
color: "white"
font.pixelSize: 32
font.bold: (active && ListView.view.currentIndex === index)
MouseArea{
anchors.fill: parent
onClicked: {
if(!active)
{
active = true;
}
else
{
glacierRoller.currentIndex = index
view.currentIndex = index
active = false
}
active = true
}
}
}
......@@ -126,6 +108,11 @@ Item {
}
}
onCurrentIndexChanged: {
view.currentIndex = currentIndex
arrowDown.x = view.currentItem.width+25
}
onActiveChanged: {
if(active)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment