本文整理汇总了C++中NodeElement::connectionInProgress方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeElement::connectionInProgress方法的具体用法?C++ NodeElement::connectionInProgress怎么用?C++ NodeElement::connectionInProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeElement
的用法示例。
在下文中一共展示了NodeElement::connectionInProgress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rowsInserted
void EditorViewMViface::rowsInserted(QModelIndex const &parent, int start, int end)
{
for (int row = start; row <= end; ++row) {
mScene->setEnabled(true);
QPersistentModelIndex current = model()->index(row, 0, parent);
if (!isDescendentOf(current, rootIndex()))
continue;
Id currentId = current.data(roles::idRole).value<Id>();
if (currentId == Id::rootId())
continue;
Id parentUuid;
if (parent != rootIndex())
parentUuid = parent.data(roles::idRole).value<Id>();
if (!parent.isValid()) {
setRootIndex(current);
continue;
}
Element* elem = mScene->mainWindow()->manager()->graphicalObject(currentId);
if (elem) {
elem->setAssistApi(mGraphicalAssistApi, mLogicalAssistApi);
}
QPointF ePos = model()->data(current, roles::positionRole).toPointF();
bool needToProcessChildren = true;
if (elem) {
elem->setPos(ePos); //задаем позицию до определения родителя для того, чтобы правильно отработал itemChange
elem->setId(currentId);
/*commented out because of real sizes of elements are incorrectly changing here into initial sizes*/
// NodeElement* nodeElement = dynamic_cast<NodeElement*>(elem);
// if (nodeElement)
// nodeElement->storeGeometry();
if (item(parent) != NULL) {
elem->setParentItem(item(parent));
QModelIndex next = current.sibling(current.row() + 1, 0);
if(next.isValid() && item(next) != NULL) {
elem->stackBefore(item(next));
}
} else {
mScene->addItem(elem);
}
setItem(current, elem);
elem->updateData();
elem->connectToPort();
elem->checkConnectionsToPort();
elem->initPossibleEdges();
elem->initTitles();
// elem->initEmbeddedControls();
//todo: нужно привести в порядок всякие init~()
bool isEdgeFromEmbeddedLinker = false;
QList<QGraphicsItem*> selectedItems = mScene->selectedItems();
if (selectedItems.size() == 1) {
NodeElement* master = dynamic_cast<NodeElement*>(selectedItems.at(0));
if (master && master->connectionInProgress()) {
isEdgeFromEmbeddedLinker = true;
}
}
if (!isEdgeFromEmbeddedLinker) {
mScene->clearSelection();
elem->setSelected(true);
}
NodeElement* nodeElem = dynamic_cast<NodeElement*>(elem);
if (nodeElem && currentId.element() == "Class" &&
mGraphicalAssistApi->children(currentId).empty())
{
needToProcessChildren = false;
for (int i = 0; i < 2; i++) {
QString curChildElementType;
if (i == 0)
curChildElementType = "MethodsContainer";
else
curChildElementType = "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);
NodeElement * nodeElement = dynamic_cast<NodeElement*>(elem);
if (nodeElement)
nodeElement->alignToGrid();
}
QAbstractItemView::rowsInserted(parent, start, end);
}