[SailfishDevel] connect gridview on delegates click signal

Matt Austin mail at mattaustin.me.uk
Fri Oct 18 10:52:31 UTC 2013


On 18 October 2013 16:43, Franck Routier (perso) <alci at mecadu.org> wrote:
> 2) create a function in the gridview, and call it in the delegate onClicked
> handler. But then, I could find a way the pass a reference to the delegate
> (using this keyword resulted in an undefined variable).

Hi Franck,


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'):


On your detail page, define a (variant) property:

Page {
    id: detailPage
    property variant myModel

    PageHeader {
        title: detailPage.myModel ? detailPage.myModel.title : 'Detail Page'
    }
}


On your grid page, for the grid delegate onclicked event:

        onClicked: {
            detailPage.myModel = modelData;
            pageStack.push(detailPage);
        }


Hope that helps!


-- 
Matt
mail at mattaustin.me.uk
http://mattaustin.me.uk/


More information about the Devel mailing list