本文整理汇总了C++中FormEditorItem类的典型用法代码示例。如果您正苦于以下问题:C++ FormEditorItem类的具体用法?C++ FormEditorItem怎么用?C++ FormEditorItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormEditorItem类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: topAnchorLineHandleItem
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();
}
}
}
示例2: view
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;
}
}
示例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: scene
FormEditorItem* ItemCreatorTool::calculateContainer(const QPointF &point)
{
QList<QGraphicsItem *> list = scene()->items(point);
foreach (QGraphicsItem *item, list) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if (formEditorItem && formEditorItem->isContainer())
return formEditorItem;
}
示例5: scene
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()
&& !isAncestorOf(currentItem, formEditorItem))
return formEditorItem;
}
示例6: view
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;
}
示例7: scene
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));
}
示例8: topMovableGraphicsItem
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;
}
示例9: hideNodeFromScene
void FormEditorView::hideNodeFromScene(const QmlItemNode &qmlItemNode)
{
if (qmlItemNode.isValid()) {
FormEditorItem *item = m_scene->itemForQmlItemNode(qmlItemNode);
QList<QmlItemNode> nodeList;
nodeList.append(qmlItemNode.allSubModelNodes());
nodeList.append(qmlItemNode);
QList<FormEditorItem*> removedItemList;
removedItemList.append(scene()->itemsForQmlItemNodes(nodeList));
m_currentTool->itemsAboutToRemoved(removedItemList);
item->setFormEditorVisible(false);
}
}
示例10: foreach
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;
}
}
示例11: targetContainerOrRootItem
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;
}
}
}
示例12: nearestFormEditorItem
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);
}
示例13: deleteSnapLines
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);
//.........这里部分代码省略.........