bool isVisible(const SelectionContext &selectionContext) const { if (selectionContext.singleNodeIsSelected()) return selectionContext.currentSingleSelectedNode().metaInfo().hasProperty("color"); return false; }
bool AddTabDesignerAction::isVisible(const SelectionContext &selectionContext) const { if (selectionContext.singleNodeIsSelected()) { ModelNode selectedModelNode = selectionContext.currentSingleSelectedNode(); return isTabView(selectedModelNode) || isTabAndParentIsTabView(selectedModelNode); } return false; }
virtual void updateContext() { menu()->clear(); if (selectionContext().isValid()) { action()->setEnabled(isEnabled(selectionContext())); action()->setVisible(isVisible(selectionContext())); } else { return; } if (action()->isEnabled()) { ModelNode parentNode; if (selectionContext().singleNodeIsSelected() && !selectionContext().currentSingleSelectedNode().isRootNode() && selectionContext().currentSingleSelectedNode().hasParentProperty()) { ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select); selectionAction->setParent(menu()); parentNode = selectionContext().currentSingleSelectedNode().parentProperty().parentModelNode(); selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select parent: %1")).arg( captionForModelNode(parentNode))); SelectionContext nodeSelectionContext = selectionContext(); nodeSelectionContext.setTargetNode(parentNode); selectionAction->setSelectionContext(nodeSelectionContext); menu()->addAction(selectionAction); } foreach (const ModelNode &node, selectionContext().view()->allModelNodes()) { if (node != selectionContext().currentSingleSelectedNode() && node != parentNode && contains(node, selectionContext().scenePosition()) && !node.isRootNode()) { selectionContext().setTargetNode(node); QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select: %1")).arg(captionForModelNode(node)); ActionTemplate *selectionAction = new ActionTemplate(what, &ModelNodeOperations::select); SelectionContext nodeSelectionContext = selectionContext(); nodeSelectionContext.setTargetNode(node); selectionAction->setSelectionContext(nodeSelectionContext); menu()->addAction(selectionAction); } } }
void SetContext(SelectionContext& sctx) { sctx.Add(credential, attr_id); dynamic_cast<CwOutlineBase*>(TQPARENT(this))->SetContext(sctx); }
bool isVisible(const SelectionContext &selectionContext) const { if (selectionContext.singleNodeIsSelected()) return modelNodeHasUrlSource(selectionContext.currentSingleSelectedNode()); return false; }