本文整理汇总了C++中FormEditorItem::qmlItemNode方法的典型用法代码示例。如果您正苦于以下问题:C++ FormEditorItem::qmlItemNode方法的具体用法?C++ FormEditorItem::qmlItemNode怎么用?C++ FormEditorItem::qmlItemNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormEditorItem
的用法示例。
在下文中一共展示了FormEditorItem::qmlItemNode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hoverMoveEvent
void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent * /*event*/)
{
if (!itemList.isEmpty()) {
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
if (resizeHandle) {
view()->changeToResizeTool();
return;
}
if (topSelectedItemIsMovable(itemList))
view()->changeToMoveTool();
}
FormEditorItem *topSelectableItem = 0;
foreach(QGraphicsItem* item, itemList)
{
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& !formEditorItem->qmlItemNode().isRootNode()
&& (formEditorItem->qmlItemNode().hasShowContent() || !m_selectOnlyContentItems))
{
topSelectableItem = formEditorItem;
break;
}
}
示例2: mouseMoveEvent
void AnchorTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event)
{
if (m_anchorManipulator.isActive()) {
FormEditorItem *targetItem = 0;
AnchorLineHandleItem *anchorLineHandleItem = topAnchorLineHandleItem(itemList);
if (anchorLineHandleItem && areAchorable(m_anchorManipulator.beginFormEditorItem(), anchorLineHandleItem->anchorLineController().formEditorItem())) {
targetItem = anchorLineHandleItem->anchorLineController().formEditorItem();
} else {
FormEditorItem *topFormEditItem = topFormEditorItemWithRootItem(itemList);
if (topFormEditItem && areAchorable(m_anchorManipulator.beginFormEditorItem(), topFormEditItem)) {
targetItem = topFormEditItem;
} else {
m_anchorLineIndicator.hide();
m_anchorIndicator.updateTargetPoint(m_anchorManipulator.beginFormEditorItem(), m_anchorManipulator.beginAnchorLine(), event->scenePos());
}
}
if (targetItem) {
targetItem->qmlItemNode().selectNode();
m_anchorLineIndicator.setItem(targetItem);
m_anchorLineIndicator.show(m_anchorManipulator.beginFormEditorItem()->qmlItemNode().anchors().possibleAnchorLines(m_anchorManipulator.beginAnchorLine(), targetItem->qmlItemNode()));
m_anchorIndicator.updateTargetPoint(m_anchorManipulator.beginFormEditorItem(), m_anchorManipulator.beginAnchorLine(), event->scenePos());
targetItem->qmlItemNode().selectNode();
}
}
}
示例3: foreach
foreach (QGraphicsItem *item, itemList) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
return true;
}
示例4: topSelectedItemIsMovable
bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
{
QList<QmlItemNode> selectedNodes = view()->selectedQmlItemNodes();
foreach (QGraphicsItem *item, itemList) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& selectedNodes.contains(formEditorItem->qmlItemNode())
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& (formEditorItem->qmlItemNode().hasShowContent()))
return true;
}
示例5: hoverMoveEvent
void AnchorTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event)
{
m_anchorLineIndicator.clearHighlight();
m_anchorIndicator.clearHighlight();
m_lastMousePosition = event->scenePos();
FormEditorItem *topFormEditItem = 0;
AnchorLineHandleItem *anchorLineHandleItem = topAnchorLineHandleItem(itemList);
if (anchorLineHandleItem) {
anchorLineHandleItem->setHiglighted(true);
m_anchorIndicator.highlight(anchorLineHandleItem->anchorLineController().formEditorItem(),
anchorLineHandleItem->anchorLineType());
topFormEditItem = anchorLineHandleItem->anchorLineController().formEditorItem();
if (m_hoverTimeLine.state() == QTimeLine::NotRunning) {
m_lastAnchorLineHandleItem = anchorLineHandleItem;
m_hoverTimeLine.start();
}
} else {
topFormEditItem = topFormEditorItem(itemList);
}
if (topFormEditItem) {
m_anchorLineIndicator.setItem(topFormEditItem);
m_anchorLineIndicator.show(AnchorLine::AllMask);
topFormEditItem->qmlItemNode().selectNode();
} else {
m_anchorLineIndicator.clear();
}
}
示例6: select
void SingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
{
QList<QGraphicsItem*> itemList = m_editorView->scene()->items(m_beginPoint);
QmlItemNode selectedNode;
foreach (QGraphicsItem* item, itemList)
{
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& formEditorItem->qmlItemNode().isValid()
&& (formEditorItem->qmlItemNode().instanceHasShowContent() || !selectOnlyContentItems))
{
selectedNode = formEditorItem->qmlItemNode();
break;
}
}
示例7: calculateContainer
FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem)
{
QList<QGraphicsItem *> list = scene()->items(point);
foreach (QGraphicsItem *item, list) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem
&& formEditorItem != currentItem
&& formEditorItem->isContainer()
&& !formEditorItem->qmlItemNode().modelNode().metaInfo().isLayoutable()
&& !isAncestorOf(currentItem, formEditorItem))
return formEditorItem;
}
示例8: mousePressEvent
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
m_mousePressTimer.start();
FormEditorItem* formEditorItem = nearestFormEditorItem(event->scenePos(), itemList);
if (formEditorItem
&& formEditorItem->qmlItemNode().isValid()
&& !formEditorItem->qmlItemNode().hasChildren()) {
m_singleSelectionManipulator.begin(event->scenePos());
if (event->modifiers().testFlag(Qt::ControlModifier))
m_singleSelectionManipulator.select(SingleSelectionManipulator::RemoveFromSelection);
else if (event->modifiers().testFlag(Qt::ShiftModifier))
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection);
else
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection);
} else {
if (event->modifiers().testFlag(Qt::AltModifier)) {
m_singleSelectionManipulator.begin(event->scenePos());
if (event->modifiers().testFlag(Qt::ControlModifier))
m_singleSelectionManipulator.select(SingleSelectionManipulator::RemoveFromSelection);
else if (event->modifiers().testFlag(Qt::ShiftModifier))
m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection);
else
m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection);
m_singleSelectionManipulator.end(event->scenePos());
view()->changeToMoveTool(event->scenePos());
} else {
m_rubberbandSelectionManipulator.begin(event->scenePos());
}
}
}
AbstractFormEditorTool::mousePressEvent(itemList, event);
}
示例9: checkIfStillHovering
void AnchorTool::checkIfStillHovering()
{
AnchorLineHandleItem *anchorLineHandleItem = topAnchorLineHandleItem(scene()->items(m_lastMousePosition));
if (anchorLineHandleItem && anchorLineHandleItem == m_lastAnchorLineHandleItem) {
FormEditorItem *sourceFormEditItem = anchorLineHandleItem->anchorLineController().formEditorItem();
QmlAnchors anchors(sourceFormEditItem->qmlItemNode().anchors());
if (anchors.instanceHasAnchor(anchorLineHandleItem->anchorLine())) {
QmlItemNode targetNode(anchors.instanceAnchor(anchorLineHandleItem->anchorLine()).qmlItemNode());
FormEditorItem *targetFormEditorItem = scene()->itemForQmlItemNode(targetNode);
targetFormEditorItem->showAttention();
}
}
}
示例10: createQmlItemNode
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
const QmlItemNode &parentNode,
const QPointF &scenePosition)
{
MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
QPointF positonInItemSpace = parentItem->qmlItemNode().instanceSceneContentItemTransform().inverted().map(scenePosition);
m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, positonInItemSpace, parentNode);
QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode);
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
}
示例11: topItemIsMovable
bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
{
QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
if (firstSelectableItem == 0)
return false;
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(firstSelectableItem);
QList<QmlItemNode> selectedNodes = view()->selectedQmlItemNodes();
if (formEditorItem != 0
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
return true;
return false;
}
示例12: createDragNode
void DragTool::createDragNode(const QMimeData *mimeData, const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
{
if (!m_dragNode.hasModelNode()) {
FormEditorItem *targetContainerFormEditorItem = targetContainerOrRootItem(itemList);
if (targetContainerFormEditorItem) {
QmlItemNode targetContainerQmlItemNode;
if (targetContainerFormEditorItem)
targetContainerQmlItemNode = targetContainerFormEditorItem->qmlItemNode();
if (hasItemLibraryInfo(mimeData))
createQmlItemNode(itemLibraryEntryFromMimeData(mimeData), targetContainerQmlItemNode, scenePosition);
else if (hasLibraryResources(mimeData))
createQmlItemNodeFromImage(libraryResourceImageName(mimeData), targetContainerQmlItemNode, scenePosition);
m_blockMove = true;
m_startPoint = scenePosition;
}
}
}
示例13: mouseReleaseEvent
void AnchorTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *)
{
if (m_anchorManipulator.isActive()) {
AnchorLineHandleItem *anchorLineHandleItem = topAnchorLineHandleItem(itemList);
if (anchorLineHandleItem) {
m_anchorManipulator.addAnchor(anchorLineHandleItem->anchorLineController().formEditorItem(),
anchorLineHandleItem->anchorLineType());
} else {
m_anchorManipulator.removeAnchor();
}
}
FormEditorItem *topFormEditItem = topFormEditorItem(itemList);
if (topFormEditItem)
topFormEditItem->qmlItemNode().selectNode();
m_anchorManipulator.clear();
m_anchorLineIndicator.clear();
}
示例14: update
void ResizeManipulator::update(const QPointF& updatePoint, Snapper::Snapping useSnapping)
{
const double minimumWidth = 0.0;
const double minimumHeight = 0.0;
deleteSnapLines();
bool snap = useSnapping == Snapper::UseSnapping || useSnapping == Snapper::UseSnappingAndAnchoring;
if (m_resizeController.isValid()) {
FormEditorItem *formEditorItem = m_resizeController.formEditorItem();
FormEditorItem *containerItem = m_snapper.containerFormEditorItem();
if (!containerItem)
return;
QPointF updatePointInLocalSpace = m_beginFromSceneToContentItemTransform.map(updatePoint);
QmlAnchors anchors(formEditorItem->qmlItemNode().anchors());
QRectF boundingRect(m_beginBoundingRect);
if (m_resizeHandle->isBottomRightHandle()) {
boundingRect.setBottomRight(updatePointInLocalSpace);
if (snap) {
double rightOffset = m_snapper.snapRightOffset(boundingRect);
if (rightOffset < std::numeric_limits<double>::max())
updatePointInLocalSpace.rx() -= rightOffset;
double bottomOffset = m_snapper.snapBottomOffset(boundingRect);
if (bottomOffset < std::numeric_limits<double>::max())
updatePointInLocalSpace.ry() -= bottomOffset;
}
boundingRect.setBottomRight(updatePointInLocalSpace);
if (anchors.instanceHasAnchor(AnchorLineHorizontalCenter))
boundingRect.setLeft(boundingRect.left() - (updatePointInLocalSpace.x() - m_beginBoundingRect.right()));
if (anchors.instanceHasAnchor(AnchorLineVerticalCenter))
boundingRect.setTop(boundingRect.top() - (updatePointInLocalSpace.y() - m_beginBoundingRect.bottom()));
if (boundingRect.width() < minimumWidth)
boundingRect.setWidth(minimumWidth);
if (boundingRect.height() < minimumHeight)
boundingRect.setHeight(minimumHeight);
formEditorItem->qmlItemNode().setSize(boundingRect.size());
if (anchors.instanceHasAnchor(AnchorLineBottom)) {
anchors.setMargin(AnchorLineBottom,
m_beginBottomMargin - (m_beginToParentTransform.map(boundingRect.bottomRight()) - m_beginBottomRightPoint).y());
}
if (anchors.instanceHasAnchor(AnchorLineRight)) {
anchors.setMargin(AnchorLineRight,
m_beginRightMargin - (m_beginToParentTransform.map(boundingRect.bottomRight()) - m_beginBottomRightPoint).x());
}
} else if (m_resizeHandle->isTopLeftHandle()) {
boundingRect.setTopLeft(updatePointInLocalSpace);
if (snap) {
double leftOffset = m_snapper.snapLeftOffset(boundingRect);
if (leftOffset < std::numeric_limits<double>::max())
updatePointInLocalSpace.rx() -= leftOffset;
double topOffset = m_snapper.snapTopOffset(boundingRect);
if (topOffset < std::numeric_limits<double>::max())
updatePointInLocalSpace.ry() -= topOffset;
}
boundingRect.setTopLeft(updatePointInLocalSpace);
if (anchors.instanceHasAnchor(AnchorLineHorizontalCenter))
boundingRect.setRight(boundingRect.right() - (updatePointInLocalSpace.x() - m_beginBoundingRect.left()));
if (anchors.instanceHasAnchor(AnchorLineVerticalCenter))
boundingRect.setBottom(boundingRect.bottom() - (updatePointInLocalSpace.y() - m_beginBoundingRect.top()));
if (boundingRect.width() < minimumWidth)
boundingRect.setLeft(boundingRect.left() - minimumWidth + boundingRect.width());
if (boundingRect.height() < minimumHeight)
boundingRect.setTop(boundingRect.top() - minimumHeight + boundingRect.height());
formEditorItem->qmlItemNode().setSize(boundingRect.size());
formEditorItem->qmlItemNode().setPosition(m_beginToParentTransform.map(boundingRect.topLeft()));
if (anchors.instanceHasAnchor(AnchorLineTop)) {
anchors.setMargin(AnchorLineTop,
m_beginTopMargin + (-m_beginToParentTransform.map(m_beginBoundingRect.topLeft()).y() + m_beginToParentTransform.map(boundingRect.topLeft()).y()));
}
if (anchors.instanceHasAnchor(AnchorLineLeft)) {
anchors.setMargin(AnchorLineLeft,
m_beginLeftMargin + (-m_beginToParentTransform.map(m_beginBoundingRect.topLeft()).x() + m_beginToParentTransform.map(boundingRect.topLeft()).x()));
}
} else if (m_resizeHandle->isTopRightHandle()) {
boundingRect.setTopRight(updatePointInLocalSpace);
//.........这里部分代码省略.........