Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 403
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook
Accepted Solution

Calendar Event .location() problem

I am using the calendar example code as a base point and trying to make modifications. I am trying to get the location to display on the screen.


I have changed the QML to


                ListView {
                    dataModel: calendar.model

                    listItemComponents: ListItemComponent {
                        type: "item"

                        StandardListItem {
                            title: ListItemData.location
                            description: qsTr ("%1 - %2").arg(ListItemData.startTime).arg(ListItemData.endTime)



and I have added location to the model.


void Calendar::filterEvents()
    // Setup the search parameters with time range as specified by filter criterion
    EventSearchParameters searchParameters;

    const QList<CalendarEvent> events = m_calendarService->events(searchParameters);

    // Clear the old events information from the model

    // Iterate over the list of events
    foreach (const CalendarEvent &event, events) {
        // Copy the data into a model entry
        QVariantMap entry;
        entry["eventId"] = event.id();
        entry["accountId"] = event.accountId();
        entry["subject"] = event.subject();
        entry["location"] = event.location();
        entry["startTime"] = event.startTime().toString(Qt::DefaultLocaleShortDate);
        entry["endTime"] = event.endTime().toString(Qt::DefaultLocaleShortDate);

        // Add the entry to the model

 But nothing ever gets displayed. Yet when I drill into the event, there is a location. What am I missing?


Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Calendar Event .location() problem

Is anything else showing in your list? Is the DataModel properly connected? Are you using the correct type in your ListItemComponent?

BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Posts: 403
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: Calendar Event .location() problem

Yes. All other fields that I am trying to access show up. The location is a defined as EventLocation type which is really then defined as a QString when I click on the reference.



Posts: 403
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: Calendar Event .location() problem

Solved: The EventSearchParameters has a .setDetails flag. The flag that you use dictact which information that you get. Just set the correct DetailLevel.