Welcome!

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

Reply
Contributor
Posts: 48
Registered: ‎11-03-2011
My Device: Playbook
My Carrier: None
Accepted Solution

Listview / Sheet Problem - item not selected after sheet is opened.

Hi,

 

In my main.qml I have a listview using the standardlistitem.

 

I have a context menu attached to the standardlistitems.

 

Now at first I had an issue selecting a list item when I invoked one of the options in the context menu from the item. The item  does not get selected when you bring up the menu.

 

To resolve this I use the onTriggered signal within the context menu to call select on the listview. This invokes the onSelectionChanged signal of the listView itself.

 

Here is my issue now:

 

If I invoke a c++ function from this onSelectionChanged signal of the main.qml and in that c++ function I call the selected() funtion on the listview to get the indexPath the function works properly and the index is returned.

 

But if I first make a sheet visible and call the c++ function from within the sheet the call to selected() returns nothing.

 

There is nothing in my qml or cpp that clears the selection, does this happen by default or something when the sheet is opened?

 

Thx. 

Developer
Posts: 49
Registered: ‎08-21-2012
My Device: Blackberry z10 LE
My Carrier: Vodafone

Re: Listview / Sheet Problem - item not selected after sheet is opened.

You need to use highlight property of ListView and in each delegate item you need to put a click event in which you can you "ListView.currentIndex = index"

 

 

Using currentIndex property you can always change the selected item in JavaScript

Nokia Qt Ambassador
http://www.softairrealfight.net
Retired
Posts: 138
Registered: ‎05-11-2012
My Device: Developer
My Carrier: Developer

Re: Listview / Sheet Problem - item not selected after sheet is opened.

Did this answer work for you?

 

Graham

New Contributor
Posts: 5
Registered: ‎02-25-2011
My Device: Not Specified

Re: Listview / Sheet Problem - item not selected after sheet is opened.

Did you have any luck with this issue?  I'm coming across the same thing.