[SailfishDevel] connect gridview on delegates click signal
Franck Routier (perso)
alci at mecadu.org
Thu Nov 21 13:16:22 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thanks for your tips, and sorry for the laaaate reply.
Le 18/10/2013 12:50, Matt Austin a écrit :
>
> I think you should be able to get what you're after with the
> following - assuming you have a reference to your 'detail page'
> (lets call it 'detailPage'):
That's the point. How do I get a reference to my detail page in my
grid page ?
I guess I should instanciate it in some way... maybe using a Loader ?
Here is what I tried:
GridView {
id: gridView
anchors.fill: parent
cellHeight: 150
cellWidth:110
model: ListModel {
ListElement {
ico: "qrc:///card1.png"
val: 1
}
ListElement {
ico: "qrc:///card2.png"
val: 2
}
}
Loader { id: pageLoader }
header: PageHeader {
title: "Choose your card !"
}
delegate: Card {
source: ico
value: val
onClicked: {
pageLoader.source = "CardPage.qml"
pageLoader.item.currentCard = this
pageStack.push(pageLoader.item)
}
}
}
with CardPage defined like this:
Page {
id: page
property variant currentCard
Column {
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: "Your card !"
}
Card {
source: currentCard.source
value: currentCard.value
}
}
}
I get the CardPage to be displayed, but then references to currentCard
are undefined. Maybe I shouldn't be using 'this' keyword ?
Or is there a better way to have a shared object to let my page
communicate ?
Thanks in advance,
Franck
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSjgemAAoJEGEvoAir78RosRsH/1geVAWzTlaajeWyMapZUU+o
GeDYg0uE91a7WM4iaFFHtmLOeIvTIXYZN3VuWqhDxJKNy5vgg0Oj87VjLLGxQIMl
54k0S3gF9rJx2nb0YW5sip7FXM+voM/bKeswuuvEyJaJ5CaArhei4gr2Khy24ZRh
DSLj9TmB6+YL3S8HFE8igPo6U+I6ND7VkWgxuenwMWZF9GKqou6NLLvn8fpAyESn
jdMgETXWLJ/gQeQNw/WPabn28b1SGZj4rRZWLU4tEKDk30hf/Y6TN3rJ2Def8usL
stouaLWmwHFT36Ek9889Qgee7Zpq1uG0/DMQPPr2sGGLqev+JcCT6EJtjhPkYp8=
=8yHw
-----END PGP SIGNATURE-----
More information about the Devel
mailing list