| 290 | } |
| 291 | |
| 292 | void AnnotationDisplay::customContextMenu(QModelIndex index, QMenu *menu) |
| 293 | { |
| 294 | RDTreeWidgetItem *item = m_Tree->itemForIndex(index); |
| 295 | |
| 296 | const SDObject *obj = m_Items.key(item, NULL); |
| 297 | if(!obj) |
| 298 | return; |
| 299 | |
| 300 | rdcstr path; |
| 301 | // don't include the root node, it's not part of the path, so only iterate over nodes that have |
| 302 | // parents themselves |
| 303 | while(obj && obj->GetParent()) |
| 304 | { |
| 305 | if(path.empty()) |
| 306 | path = obj->name; |
| 307 | else |
| 308 | path = obj->name + rdcstr(".") + path; |
| 309 | obj = obj->GetParent(); |
| 310 | } |
| 311 | |
| 312 | if(path.empty()) |
| 313 | return; |
| 314 | |
| 315 | QAction *sep = menu->insertSeparator(menu->actions()[0]); |
| 316 | |
| 317 | QAction *showInEventBrowser = new QAction(tr("&Highlight in Event Browser"), menu); |
| 318 | |
| 319 | QObject::connect(showInEventBrowser, &QAction::triggered, |
| 320 | [this, path]() { m_Ctx.GetEventBrowser()->SetHighlightedAnnotation(path); }); |
| 321 | |
| 322 | menu->insertAction(sep, showInEventBrowser); |
| 323 | } |
| 324 | |
| 325 | void AnnotationDisplay::itemClicked(RDTreeWidgetItem *item, int column) |
| 326 | { |
nothing calls this directly
no test coverage detected