Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › Felgo QML : onItemSelected of ListPage is never called

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #20069

    Alex Tekeuf

    Hi everybody!
    I’m new in Felgo, and I’m trying to do a simple thing : Display a list and open a page when an item of the list is clicked.

    Here is my code, in one page :

    import Felgo 3.0
    import QtQuick 2.0
    App {    
        Component { id: pageComponent; Page { } }
        NavigationStack {
            ListPage {
                title: qsTr("Test")
                id: testListPage
                activeFocusOnTab: false
                listView.emptyText.text: qsTr("Empty list")
                model: [
                    {text: "Text 1", detailText: "Detail text 1", icon: IconType.android},
                    {text: "Text 2", detailText: "Detail text 2", icon: IconType.android},
                    {text: "Text 3", detailText: "Detail text 3", icon: IconType.android},
                    {text: "Text 4", detailText: "Detail text 4", icon: IconType.android},
                    {text: "Text 5", detailText: "Detail text 5", icon: IconType.android}
                onItemSelected: {
                    navigationStack.push(pageComponent, { title: item.text, rightBarItem: null })
                delegate: SimpleRow { }


    The list is displayed well but Nothing happen when I click on an item. And when I try to debug it, I never break into the onItemSelected function.
    I might miss Something but I really Don’t know what…
    Thanks in advance!



    Maybe you already solved this, but just in case…



    You have two options, one of them is simply not overriding the default delegate. As stated in their docs:
    itemSelected(int = index, var = item)

    This convenience handler gets called when a row within the contained listView was selected.

    Note: This is only called if the delegate is not overridden by a custom delegate.


    Since the default delegate is already a SimpleRow, you could just delete the delegate line in your code.


    The other one is using onSelected inside SimpleRow in case you want more customization of your delegate:

    delegate: SimpleRow{
      onSelected: navigationStack.push(pageComponent, { title: modelData.text, rightBarItem: null })

    Alex Tekeuf

    Thanks a lot it worked!!! 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded