0

I'm using a ListView in my Cascades app and I'm doing most of the stuff in QML. Here is the attachedObjects: [ ] inside the ListView:

attachedObjects: [
    FmnModel {
        id: fmnModel
    },
    FmnListModel {
        id: asynkDataSource
        source: "sql/fgmt.db"
        query: "SELECT lists.id, lists.name, (SELECT COUNT(1) FROM tasks WHERE tasks.listid=lists.id AND tasks.status=\"Pending\") AS pendings FROM lists"

        onDataLoaded: {
            if(data.length > 0) {
                fmnModel.insertList(data);
            }
        }
    }
] // Attached Objects

And the code which loads the next page into the NavigationPane:

property variant taskpaged
onTriggered: {
    taskpaged = taskPageDefinition.createObject();
    navPane.push(taskpaged);

    taskpaged.back.connect(navPane.pop);
}

So when I click "Back" in the taskpaged Page, the app crashes. Any idea why? Or do I need to provide more code? (If yes, which?)

animuson
  • 53,861
  • 28
  • 137
  • 147
Roshnal
  • 1,284
  • 3
  • 16
  • 39
  • What is an FmnModel or an FmnListModel, they don't show up in the API search. – Richard Dec 28 '12 at 00:05
  • `FmnModel` is a custom QML that's basically a `GroupDataModel` and `FmnListModel` is a slightly modified version of `customdatasource` in the Quotes Cascades sample. – Roshnal Dec 28 '12 at 11:17

2 Answers2

0

Some errors may be thrown but you can't see them if you started from a page then pushed another page. Let your app point to (taskpage) as the first page to be loaded. you will see that there is number of exceptions. fix them then return back to the original code

Hisham Bakr
  • 559
  • 4
  • 13
0

You need to have signal back() declared on the top level element in the QML for your taskPageDefinition. Then you also need to define the navigation pane properties for the page, and specify the action that occurs with the back button is clicked:

Page {
  id: taskPage
  signal back()

  paneProperties: NavigationPaneProperties {
    backButton: ActionItem {
        onTriggered: {
            // Send the back() signal, which you already connected to nav.pop()
            taskPage.back();
        }
    }
  }
}

Hopefully that helps. You can also take a look at this question, I posted a full navigation pane example there, but in that one I just call nav.pop() from the onTriggered of the back button directly. Here you are using signals and slots.

Community
  • 1
  • 1
nonesuchnick
  • 627
  • 4
  • 17