Hey guys

I am writing a QT application and I have hit a bit of a wall.

I have a file containing an undetermined number of data entries (blocks of 512 bytes). Each data entry contains a collection of variables as well as a data entry name, and a data entry category.

I have created the code to look at this file and generate a QMenu. Basically the code creates sub-menus for each unique category found in the file, and then obtains the name of each data entry and places it in the correct category.

This works fine and the menu appears as expected however the next step is where I am struggling. I have a function that requires arguments extracted from the data entry.

So my question is this How can I add the required function calls to the QActions?

Here is an extract of the relevant part of my code!

Qt Code:
  1. // Create the menu structure
  2.  
  3. // *********************
  4. // ** CREATE BASE MENU
  5. QMenu *menu = new QMenu((QWidget*)ui->button);
  6. // *********************
  7. for(int i = 0; i < numberOfCategories; i++){
  8. // *******************
  9. // ** CREATE SUB MENU
  10. QMenu *submenu = new QMenu(dataEntryCategoryNameList[i], (QWidget*)menu);
  11. // *******************
  12. // ** FIND ALL DATA ENTRIES THAT ARE PART OF THE CURRENT CATEGORY
  13. for(int j = 0; j < dataEntryCount; j++){
  14. if(memcmp(dataEntryCategoryNameList[i], &dataEntryRawDataList[j][220], 30)==0){
  15. // **********************
  16. // ** ADD ACTION TO MENU
  17. char temp[30];
  18. memset(temp, 0x00, 30);
  19. memcpy(temp, &dataEntryRawDataList[j][0], 30);
  20. // OBTAIN RELEVANT COMMAND OPTIONS FOR THE CURRENT DATA ENTRY
  21. int var1 = /*value obtained from file*/
  22. int var2 = /*value obtained from file*/
  23. int var3 = /*value obtained from file*/
  24. int var4 = /*value obtained from file*/
  25. int var5 = /*value obtained from file*/
  26.  
  27. //Function I want to call for the current data entry:
  28. // myFunction(var1, var2, var3, var4, var5)
  29. QAction *action = new QAction(temp, (QObject*)submenu);
  30. submenu->addAction(action);
  31. // **********************
  32. }
  33. }
  34. menu->addMenu(submenu);
  35. }
  36. menu->exec(QCursor::pos());
To copy to clipboard, switch view to plain text mode 

Thanks for reading and I appreciate any help!