コード例 #1
0
ファイル: anchortool.cpp プロジェクト: renatofilho/QtCreator
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();
    }
}
コード例 #2
0
void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint)
{
    m_beginPoint = beginPoint;
    m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint);
    m_selectionRectangleElement.show();
    m_isActive = true;
    QDeclarativeViewInspectorPrivate *inspectorPrivate
            = QDeclarativeViewInspectorPrivate::get(m_editorView);
    m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint));
    m_oldSelectionList = m_editorView->selectedItems();
}
コード例 #3
0
ファイル: anchortool.cpp プロジェクト: renatofilho/QtCreator
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();
}
コード例 #4
0
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
                                    QGraphicsSceneMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        m_mousePressTimer.start();
        FormEditorItem* formEditorItem = topFormEditorItem(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, m_selectOnlyContentItems);
            else if (event->modifiers().testFlag(Qt::ShiftModifier))
                m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
            else
                m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);
        } else {
            if (event->modifiers().testFlag(Qt::AltModifier)) {
                m_singleSelectionManipulator.begin(event->scenePos());

                if (event->modifiers().testFlag(Qt::ControlModifier))
                    m_singleSelectionManipulator.select(SingleSelectionManipulator::RemoveFromSelection, m_selectOnlyContentItems);
                else if (event->modifiers().testFlag(Qt::ShiftModifier))
                    m_singleSelectionManipulator.select(SingleSelectionManipulator::AddToSelection, m_selectOnlyContentItems);
                else
                    m_singleSelectionManipulator.select(SingleSelectionManipulator::ReplaceSelection, m_selectOnlyContentItems);

                m_singleSelectionManipulator.end(event->scenePos());
                view()->changeToMoveTool(event->scenePos());
            } else {
                m_rubberbandSelectionManipulator.begin(event->scenePos());
            }
        }
    }

    AbstractFormEditorTool::mousePressEvent(itemList, event);
}