I have a context menu on a table with options to add a Capability and Capacity for a certain row. When the user clicks on one of those options they need to provide a name.
For my logic I need to know the row instance, but it seems that this info is not available. How can I know for which row the user has selected one of the options?
Hi Jens, see the context menu help section that explains how to use a context menu on a table.
The object that is passed to the QAction can be casted as a string array. Item[1] is the discrete value, Items[2...n] are the additional arguments.
If you have for example defined <Discreet options="table:selection" dependencyValues="114;115"> , then Item[2] will contain the filled in value for parameter 114, Item[3] will contain the filled in value for parameter 115, Item [4...n] are the primary keys of all the rows that were selected.
In your example there is only one dependency value defined (present on Item[2]) and only one row selection possible so the selected primary key should be present on Item[3], which discrete value has been selected can be discovered on Item[1] (will be either value 50 (=Add Capability) or 51 (=Add Capacity))