Created
March 7, 2015 12:32
-
-
Save bluszcz/0c7026c6b4c2f9a102fa to your computer and use it in GitHub Desktop.
Problem with Repeater / Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
import Sailfish.Silica 1.0 | |
Page { | |
id: page | |
SilicaFlickable { | |
anchors.fill: parent | |
PullDownMenu { | |
MenuItem { | |
text: qsTr("Credits") | |
onClicked: pageStack.push(Qt.resolvedUrl("Credits.qml")) | |
} | |
} | |
contentHeight: column.height | |
Column { | |
id: column | |
width: page.width | |
spacing: Theme.paddingLarge | |
PageHeader { | |
title: qsTr("Veggie Sailor") | |
} | |
Repeater { | |
id: repeater | |
width: page.width | |
model: ListModel { | |
ListElement { | |
mytext: "Barcelona" | |
image: "qrc:///static/images/barcelona.jpg" | |
} | |
ListElement { | |
mytext: "Copenhagen" | |
image: "qrc:///static/images/copenhagen.jpg" | |
} | |
} | |
delegate: customblock | |
} | |
Component { | |
id: customblock | |
Rectangle { | |
Label { | |
text: qsTr(mytext) | |
color: Theme.secondaryHighlightColor | |
x: Theme.paddingLarge | |
} | |
Image { | |
width: column.width | |
height: 200 | |
fillMode: Image.PreserveAspectCrop | |
source: image | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment