01-04-2013 01:45 AM
I have a QML/C++ project in which the ListView's context actions are setup as in the first code block below:
And the custom slots assigned to the triggered() signals of each of the ListItems as in the 2nd code block (in the above link).
So my question is, how do I get the item data from which the context action was invoked upon? For example, say I have a list of food items:
And the list has a context menu with the items "Eat", "Cook", and etc. and I have connected the "Eat"'s triggered() signal to a custom slot called "eatTheFood()". And from that slot, how do I know which food item was selected to eat?
01-04-2013 02:48 AM
01-04-2013 03:00 AM
01-04-2013 03:02 AM
01-04-2013 04:43 AM
It worked... But yeah, the context menu shows up when you long-press after the last list item. And your second solution (adding the contextActions inside the ListItem (I use StandardListItem)) resolves this issue, then the C++ code in the link doesn't work. I'm completely handing every signals/slots in my C++ code, so I think I can't send a signal from QML to be caught in C++?