void GraphDraw::mouseMoveEvent(QMouseEvent *event) { QGraphicsView::mouseMoveEvent(event); //handle the first move event transition from a press event if (_selectionState == SELECTION_STATE_PRESS) { _selectionState = SELECTION_STATE_MOVE; //record positions to determine movement on release _preMovePositions.clear(); for (auto obj : getObjectsSelected(~GRAPH_CONNECTION)) { _preMovePositions[obj] = obj->pos(); } } //cause full render when moving objects for clean animation if (_selectionState == SELECTION_STATE_MOVE) this->render(); //auto scroll near boundaries if (_selectionState != SELECTION_STATE_NONE) { handleAutoScroll(this->horizontalScrollBar(), this->size().width(), this->mapToScene(event->pos()).x()); handleAutoScroll(this->verticalScrollBar(), this->size().height(), this->mapToScene(event->pos()).y()); } }
void TrackEditor::slotLoopDraggedToPosition(timeT position) { if (!m_doc) return; int currentEndLoopPos = m_doc->getComposition().getLoopEnd(); double dummy; handleAutoScroll(currentEndLoopPos, position, dummy); }
void TrackEditor::slotPointerDraggedToPosition(timeT position) { int currentPointerPos = m_compositionView->getPointerPos(); double newPosition; if (handleAutoScroll(currentPointerPos, position, newPosition)) m_compositionView->drawPointer(int(newPosition)); }
void GraphDraw::mouseMoveEvent(QMouseEvent *event) { QGraphicsView::mouseMoveEvent(event); //implement mouse tracking for blocks const auto scenePos = this->mapToScene(event->pos()); for (auto obj : this->getGraphObjects()) { obj->updateMouseTracking(obj->mapFromParent(scenePos)); } //handle drawing in the click, drag, connect mode const auto topObj = _lastClickSelectEp.getObj(); if (_connectLineItem and topObj) { const auto attrs = topObj->getConnectableAttrs(_lastClickSelectEp.getKey()); const auto newPos = topObj->mapFromParent(scenePos); _connectLineItem->setLine(QLineF(attrs.point, newPos)); } //handle the first move event transition from a press event if (_selectionState == SELECTION_STATE_PRESS) { _selectionState = SELECTION_STATE_MOVE; //record positions to determine movement on release _preMovePositions.clear(); for (auto obj : getObjectsSelected(~GRAPH_CONNECTION)) { _preMovePositions[obj] = obj->pos(); } } //cause full render when moving objects for clean animation if (_selectionState == SELECTION_STATE_MOVE) this->render(); //auto scroll near boundaries if (_selectionState != SELECTION_STATE_NONE) { handleAutoScroll(this->horizontalScrollBar(), this->size().width(), this->mapToScene(event->pos()).x()); handleAutoScroll(this->verticalScrollBar(), this->size().height(), this->mapToScene(event->pos()).y()); } }