0

I have a QTreeView with names. I added a contextMenu as here:

  _treeMenu = new QMenu(myTreeView);
  _editTreeViewAction = new QAction("Edit Selection", _treeMenu);
  _deleteTreeViewAction = new QAction("Delete Selection",_treeMenu);
  myTreeView->addAction(_editTreeViewAction);
  myTreeView->addAction(_deleteTreeViewAction);
  myTreeView->setContextMenuPolicy(Qt::ActionsContextMenu);

  connect(_editTreeViewAction, SIGNAL(triggered(bool)), this, SLOT(onEdit(bool)));
  connect(_deleteTreeViewAction, SIGNAL(triggered(bool)), this, SLOT(onDelete(bool)));

When I hit 'Edit Selection', SLOT onEdit() is properly triggered. But here I need the QStadardItem (* Pointer or at least its text()) from the QTreeView where I rightclicked ? How can I access that?

Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103

1 Answers1

0

That solves myissue: myTreeView.currenIndex();

Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103