本文整理汇总了C++中NodeElement::storeGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeElement::storeGeometry方法的具体用法?C++ NodeElement::storeGeometry怎么用?C++ NodeElement::storeGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeElement
的用法示例。
在下文中一共展示了NodeElement::storeGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseReleaseEvent
void EmbeddedLinker::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
updateMasterEdges();
hide();
mMaster->selectionState(false);
EditorViewScene* scene = dynamic_cast<EditorViewScene*>(mMaster->scene());
if (!mPressed && scene && mEdge) {
mEdge->hide();
QPointF const &eScenePos = event->scenePos();
NodeElement *under = dynamic_cast<NodeElement*>(scene->itemAt(eScenePos, QTransform()));
mEdge->show();
int result = 0;
commands::CreateElementCommand *createElementFromMenuCommand = NULL;
if (!under) {
result = scene->launchEdgeMenu(mEdge, mMaster, eScenePos, &createElementFromMenuCommand);
NodeElement *target = dynamic_cast<NodeElement*>(scene->getLastCreated());
if (result == -1) {
mEdge = NULL;
} else if ((result == 1) && target) {
mEdge->setDst(target);
target->storeGeometry();
}
}
if (result != -1) {
mEdge->connectToPort();
mEdge->adjustNeighborLinks();
mEdge->correctArrow();
mEdge->correctInception();
mEdge->adjustNeighborLinks();
// This will restore edge state after undo/redo
commands::ReshapeEdgeCommand *reshapeEdge = new commands::ReshapeEdgeCommand(mEdge);
reshapeEdge->startTracking();
reshapeEdge->stopTracking();
reshapeEdge->setUndoEnabled(false);
if (createElementFromMenuCommand) {
createElementFromMenuCommand->addPostAction(reshapeEdge);
mCreateEdgeCommand->addPostAction(createElementFromMenuCommand);
} else {
mCreateEdgeCommand->addPostAction(reshapeEdge);
}
}
}
mPressed = false;
mEdge = NULL;
}
示例2: QPointF
NodeElement *CopyHandler::clone(bool toCursorPos, bool searchForParents)
{
EditorViewScene *evscene = dynamic_cast<EditorViewScene *>(mNode.scene());
qReal::Id typeId = mNode.id().type();
qReal::Id resultId = evscene->createElement(typeId.toString(), QPointF(), searchForParents);
NodeElement *result = dynamic_cast<NodeElement *>(evscene->getElem(resultId));
copyProperties(*result, mNode);
copyChildren(*result, mNode);
QRectF contents = mNode.contentsRect();
if (toCursorPos) {
contents.moveTo(evscene->getMousePos());
result->setGeometry(contents);
result->storeGeometry();
}
else {
contents.moveTo(mNode.pos());
result->setGeometry(contents);
}
return result;
}
示例3: mouseReleaseEvent
void NodeElement::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (dynamic_cast<NodeElement *>(scene()->mouseGrabberItem()) == this) {
ungrabMouse();
}
if (event->button() == Qt::RightButton) {
event->accept();
return;
}
deleteGuides();
storeGeometry();
if (scene() && (scene()->selectedItems().size() == 1) && isSelected()) {
setVisibleEmbeddedLinkers(true);
}
if (mDragState == None) {
Element::mouseReleaseEvent(event);
}
EditorViewScene *evScene = dynamic_cast<EditorViewScene *>(scene());
commands::InsertIntoEdgeCommand *insertCommand = new commands::InsertIntoEdgeCommand(
*evScene, mModels, id(), id(), Id::rootId(), event->scenePos(), boundingRect().bottomRight(), false);
bool shouldProcessResize = true;
// we should use mHighlightedNode to determine if there is a highlighted node
// insert current element into them and set mHighlightedNode to nullptr
// but because of mouseRelease twice triggering we can't do it
// This may cause more bugs
if (flags() & ItemIsMovable) {
if (mHighlightedNode) {
NodeElement *newParent = mHighlightedNode;
Element *insertBefore = mHighlightedNode->getPlaceholderNextElement();
mHighlightedNode->erasePlaceholder(false);
// commented because of bug with double event sending (see #204)
// mHighlightedNode = nullptr;
QPointF newPos = mapToItem(newParent, mapFromScene(scenePos()));
AbstractCommand *parentCommand = changeParentCommand(newParent->id(), newPos);
mController->execute(parentCommand);
// Position change already processed in change parent command
shouldProcessResize = parentCommand == nullptr;
setPos(newPos);
if (insertBefore) {
mGraphicalAssistApi.stackBefore(id(), insertBefore->id());
}
newParent->resize();
while (newParent) {
newParent->mContents = newParent->mContents.normalized();
newParent->storeGeometry();
newParent = dynamic_cast<NodeElement*>(newParent->parentItem());
}
} else {
AbstractCommand *parentCommand = changeParentCommand(evScene->rootItemId(), scenePos());
mController->execute(parentCommand);
// Position change already processed in change parent command
shouldProcessResize = parentCommand == nullptr;
}
}
for (EdgeElement* edge : mEdgeList) {
edge->layOut();
if (SettingsManager::value("ActivateGrid").toBool()) {
edge->alignToGrid();
}
}
if (shouldProcessResize && mResizeCommand) {
mResizeCommand->addPostAction(insertCommand);
endResize();
}
updateBySelection();
mDragState = None;
}
示例4: mouseReleaseEvent
void EmbeddedLinker::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
hide();
mMaster->selectionState(false);
EditorViewScene* scene = dynamic_cast<EditorViewScene*>(mMaster->scene());
if (!mPressed && scene && mEdge) {
mEdge->hide();
QPointF const &eScenePos = event->scenePos();
NodeElement *under = dynamic_cast<NodeElement*>(scene->itemAt(eScenePos, QTransform()));
mEdge->show();
int result = 0;
commands::CreateElementCommand *createElementFromMenuCommand = NULL;
if (!under) {
result = scene->launchEdgeMenu(mEdge, mMaster, eScenePos, false, &createElementFromMenuCommand);
} else {
bool canBeConnected = false;
foreach(PossibleEdge const &pEdge, mEdge->src()->getPossibleEdges()) {
if (pEdge.first.second.element() == under->id().element()) {
canBeConnected = true;
} else {
// pEdge.second.first is true, if edge can connect items in only one direction.
if (!pEdge.second.first) {
canBeConnected = (pEdge.first.first.element() == under->id().element());
}
}
}
if (under->isContainer()) {
result = scene->launchEdgeMenu(mEdge, mMaster, eScenePos,
canBeConnected, &createElementFromMenuCommand);
} else {
if (!canBeConnected) {
result = -1;
}
}
}
NodeElement *target = dynamic_cast<NodeElement*>(scene->getLastCreated());
if (result == -1) {
mEdge = NULL;
} else if ((result == 1) && target) {
mEdge->setDst(target);
target->storeGeometry();
}
if (result != -1) {
mEdge->connectToPort();
updateMasterEdge();
// This will restore edge state after undo/redo
commands::ReshapeEdgeCommand *reshapeEdge = new commands::ReshapeEdgeCommand(mEdge);
reshapeEdge->startTracking();
reshapeEdge->stopTracking();
reshapeEdge->setUndoEnabled(false);
if (createElementFromMenuCommand) {
createElementFromMenuCommand->addPostAction(reshapeEdge);
mCreateEdgeCommand->addPostAction(createElementFromMenuCommand);
} else {
mCreateEdgeCommand->addPostAction(reshapeEdge);
}
}
}