void mainmenu(void) /* Executes the commands in the main menu */ { switch(getcommand(MENU, COMMAND)) { case 0 : smenu(); break; case 1 : formatcells(); break; case 2 : deletecell(curcol, currow, UPDATE); printfreemem(); if (autocalc) recalc(); break; case 3 : gotocell(); break; case 4 : cmenu(); break; case 5 : rmenu(); break; case 6 : editcell(curcell); break; case 7 : umenu(); break; case 8 : changeautocalc(!autocalc); break; case 9 : checkforsave(); stop = TRUE; break; } /* switch */ } /* mainmenu */
void ResourceDock::rightClickedAct(const QPoint & pos) { QTreeWidgetItem *item = resTree->currentItem(); QMenu cmenu(this); QPoint pt(pos); pt.setY(pt.y() + 50); if (item != nullptr) { // checking user rclicked on category or items? if (item->parent() == nullptr) { actAddNew->setText("Add New " + item->text(0)); actAddExist->setText("Add Existing " + item->text(0)); cmenu.addAction(actAddNew); cmenu.addAction(actAddExist); cmenu.exec(mapToGlobal(pt)); } else { actEdit->setText("Edit " + item->text(0)); actRemove->setText("Remove " + item->text(0)); cmenu.addAction(actEdit); cmenu.addSeparator(); cmenu.addAction(actRemove); cmenu.exec(mapToGlobal(pt)); } } }