本文整理汇总了C++中NodeElement::setGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeElement::setGeometry方法的具体用法?C++ NodeElement::setGeometry怎么用?C++ NodeElement::setGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeElement
的用法示例。
在下文中一共展示了NodeElement::setGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: handleNodeElementsForRowsInserted
void EditorViewMViface::handleNodeElementsForRowsInserted(
const QList<QPair<NodeElement *, QPersistentModelIndex> > &nodes
, const QModelIndex &parent
)
{
for (const QPair<NodeElement *, QPersistentModelIndex> &p : nodes) {
NodeElement *elem = p.first;
QPersistentModelIndex current = p.second;
Id currentId = current.data(roles::idRole).value<Id>();
bool needToProcessChildren = true;
if (elem) {
QPointF ePos = model()->data(current, roles::positionRole).toPointF();
// setting position before parent definition 'itemChange' to work correctly
elem->setPos(ePos);
elem->setGeometry(mGraphicalAssistApi->configuration(elem->id()).boundingRect().translated(ePos.toPoint()));
handleAddingSequenceForRowsInserted(parent, elem, current);
handleElemDataForRowsInserted(elem, current);
if (currentId.element() == "Class" && mGraphicalAssistApi->children(currentId).empty())
{
needToProcessChildren = false;
for (int i = 0; i < 2; i++) {
QString curChildElementType = (i == 0) ? "MethodsContainer" : "FieldsContainer";
Id newUuid = Id("Kernel_metamodel", "Kernel", curChildElementType, QUuid::createUuid().toString());
mGraphicalAssistApi->createElement(currentId, newUuid
, false, "(anonymous something)", QPointF(0, 0));
}
}
}
if (needToProcessChildren && model()->hasChildren(current)) {
rowsInserted(current, 0, model()->rowCount(current) - 1);
}
if (elem) {
elem->alignToGrid();
}
}
}