Hi everyboby!

I have a Q3PopupMenu for my ListView created.The idea from this Popupmenu is that the user can select a song and
add to a playlist(submenu)
I have a Menu and a Submenu. I generate actions with values from my Database (see code).
For example: playlist1, playlist2, playlist3(actions).
So my actions will everytime generated when the user start my popupmenu. I have a dynamic submenu with dynamic actions.
All my actions call the same function "addToPlaylist()".Thats ok.
Now i must get the selected action text from the submenu.
With QAction->text() i can read the action text. But how could i get the selected text of my popupmenu?Because my action names is everytime the same.
I need this text to be able to insert value on a database.


Have somebody a idea?

Qt Code:
  1. Q3PopupMenu* contextMenu = new Q3PopupMenu( this);
  2. Q3PopupMenu* contextMenu2 = new Q3PopupMenu( this);
  3.  
  4. if( Item )
  5. contextMenu->popup( point );
  6.  
  7. Q_CHECK_PTR( contextMenu );
  8.  
  9.  
  10.  
  11. if((ui.playlistname_cb->currentText() == "") && (ui.listView->childCount() > 0))
  12. {
  13. QSqlQuery select_playlistname("select playlistname from playlistname_tbl");
  14. while(select_playlistname.next())
  15. {
  16. QString playlistname = select_playlistname.value(0).toString();
  17. contextMenu2->setTitle("add to Playlist");
  18.  
  19. QAction *action = new QAction(playlistname, this);
  20. connect(action,SIGNAL(activated()),this,SLOT(addToPlaylist()));
  21. contextMenu2->addAction(action );
  22. contextMenu->addMenu(contextMenu2);
  23. QMessageBox::information(this,
  24. ("Info"),action->text());
  25. }
  26. contextMenu->exec( QCursor::pos() );
  27.  
  28. return;
  29. }
To copy to clipboard, switch view to plain text mode