void SceneViewerContextMenu::addSelectCommand(QMenu *menu, const TStageObjectId &id) { TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); TStageObject *stageObject = xsh->getStageObject(id); if (!stageObject) return; QString text = getName(stageObject); if (menu == this) text = "Select " + text; QAction *action = new QAction(text, this); action->setData(id.getCode()); connect(action, SIGNAL(triggered()), this, SLOT(onSetCurrent())); menu->addAction(action); }
void addShowHideStageObjectCmd(QMenu *menu, const TStageObjectId &id, bool isShow) { TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); TStageObject *pegbar = xsh->getStageObject(id); QString cmdStr; if (id.isCamera()) cmdStr = (isShow ? "Show " : "Hide ") + QString::fromStdString(pegbar->getName()); else cmdStr = (isShow ? "Show Column" : "Hide Column") + QString::fromStdString(pegbar->getName()); QAction *showHideAction = new QAction(cmdStr, menu); showHideAction->setData((int)id.getCode()); menu->addAction(showHideAction); }