MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / mouseMoveEvent

Method mouseMoveEvent

Gui/NodeGraph20.cpp:376–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374} // NodeGraph::moveSelectedNodesBy
375
376void
377NodeGraph::mouseMoveEvent(QMouseEvent* e)
378{
379 QPointF newPos = mapToScene( e->pos() );
380 QPointF lastMousePosScene = mapToScene( _imp->_lastMousePos.x(), _imp->_lastMousePos.y() );
381 double dx, dy;
382 {
383 QPointF newPosRoot = _imp->_root->mapFromScene(newPos);
384 QPointF lastMousePosRoot = _imp->_root->mapFromScene(lastMousePosScene);
385 dx = newPosRoot.x() - lastMousePosRoot.x();
386 dy = newPosRoot.y() - lastMousePosRoot.y();
387 }
388
389 _imp->_hasMovedOnce = true;
390
391 bool mustUpdate = true;
392 NodeCollectionPtr collection = getGroup();
393 NodeGroup* isGroup = dynamic_cast<NodeGroup*>( collection.get() );
394 bool isGroupEditable = true;
395 bool groupEdited = true;
396 if (isGroup) {
397 isGroupEditable = isGroup->isSubGraphEditable();
398 groupEdited = isGroup->getNode()->hasPyPlugBeenEdited();
399 }
400 if (!groupEdited && isGroupEditable) {
401 ///check if user is nearby unlock
402 // see NodeGraph::paintEvent()
403 QPoint pixPos = _imp->getPyPlugUnlockPos();
404 int pixW = _imp->unlockIcon.width();
405 int pixH = _imp->unlockIcon.height();
406 QRect pixRect(pixPos.x(), pixPos.y(), pixW, pixH);
407 pixRect.adjust(-2, -2, 2, 2);
408 QRect selRect = pixRect;
409 selRect.adjust(-3, -3, 3, 3);
410 if ( selRect.contains( e->pos() ) ) {
411 assert(isGroup);
412 QPoint pos = mapToGlobal( e->pos() );
413 // Unfortunately, the timeout delay for the tooltip is hardcoded in Qt 4, and the last parameter to showText doesn't seem to influence anything
414 // Can not fix https://github.com/MrKepzie/Natron/issues/1151 (at least in Qt4)
415 QToolTip::showText( pos, NATRON_NAMESPACE::convertFromPlainText(QCoreApplication::translate("NodeGraph", "Clicking the unlock button will convert the PyPlug to a regular group saved in the project and detach it from the script.\n"
416 "Any modification will not be written to the Python script. Subsequent loading of the project will no longer load this group from the python script."), NATRON_NAMESPACE::WhiteSpaceNormal),
417 this, selRect);
418 }
419 }
420
421 QRectF sceneR = visibleSceneRect();
422
423 bool mustUpdateNavigator = false;
424 ///Apply actions
425 switch (_imp->_evtState) {
426 case eEventStateDraggingArrow: {
427 QPointF np = _imp->_arrowSelected->mapFromScene(newPos);
428 if ( _imp->_arrowSelected->isOutputEdge() ) {
429 _imp->_arrowSelected->dragDest(np);
430 } else {
431 _imp->_arrowSelected->dragSource(np);
432 }
433 checkAndStartAutoScrollTimer(newPos);

Callers

nothing calls this directly

Calls 15

convertFromPlainTextFunction · 0.85
QCursorClass · 0.85
pushUndoCommandFunction · 0.85
maxFunction · 0.85
isSubGraphEditableMethod · 0.80
hasPyPlugBeenEditedMethod · 0.80
getPyPlugUnlockPosMethod · 0.80
isOutputEdgeMethod · 0.80
dragDestMethod · 0.80
dragSourceMethod · 0.80
translateFunction · 0.70
xMethod · 0.45

Tested by

no test coverage detected