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 { ...@@ -45,6 +45,28 @@ Page {
clip: true clip: true
model: animalsModel model: animalsModel
label: qsTr("Choose your favorite animal") 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 { GlacierRoller {
...@@ -58,5 +80,27 @@ Page { ...@@ -58,5 +80,27 @@ Page {
clip: true clip: true
model: animalsModel model: animalsModel
label: qsTr("Choose your second favorite animal") 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 { ...@@ -4,6 +4,7 @@ Item {
id: glacierRoller id: glacierRoller
property alias model : view.model property alias model : view.model
property alias label: label.text property alias label: label.text
property alias delegate: view.delegate
property int currentIndex: -1 property int currentIndex: -1
property int activateSize: 5 property int activateSize: 5
...@@ -80,30 +81,11 @@ Item { ...@@ -80,30 +81,11 @@ Item {
anchors{ anchors{
verticalCenter: view.verticalCenter 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{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if(!active) active = true
{
active = true;
}
else
{
glacierRoller.currentIndex = index
view.currentIndex = index
active = false
}
} }
} }
} }
...@@ -126,6 +108,11 @@ Item { ...@@ -126,6 +108,11 @@ Item {
} }
} }
onCurrentIndexChanged: {
view.currentIndex = currentIndex
arrowDown.x = view.currentItem.width+25
}
onActiveChanged: { onActiveChanged: {
if(active) 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