MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / mouseMoveEvent

Method mouseMoveEvent

DSView/pv/view/header.cpp:413–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void Header::mouseMoveEvent(QMouseEvent *event)
414{
415 assert(event);
416
417 if (_view.session().is_working() && _view.session().get_device()->get_work_mode() == LOGIC){
418 //Disable the hover status of trig button on left pannel.
419 return;
420 }
421
422 _mouse_point = event->pos();
423
424 // Move the Traces if we are dragging
425 if (!_drag_traces.empty()) {
426 const int delta = event->pos().y() - _mouse_down_point.y();
427
428 for (auto i = _drag_traces.begin(); i != _drag_traces.end(); i++) {
429 const auto t = (*i).first;
430 if (t) {
431 int y = (*i).second + delta;
432 if (t->get_type() == SR_CHANNEL_DSO) {
433 DsoSignal *dsoSig = NULL;
434 if ((dsoSig = dynamic_cast<DsoSignal*>(t))) {
435 dsoSig->set_zero_vpos(y);
436 _moveFlag = true;
437 traces_moved();
438 }
439 } else if (t->get_type() == SR_CHANNEL_MATH) {
440 MathTrace *mathTrace = NULL;
441 if ((mathTrace = dynamic_cast<MathTrace*>(t))) {
442 mathTrace->set_zero_vpos(y);
443 _moveFlag = true;
444 traces_moved();
445 }
446 } else if (t->get_type() == SR_CHANNEL_ANALOG) {
447 AnalogSignal *analogSig = NULL;
448 if ((analogSig = dynamic_cast<AnalogSignal*>(t))) {
449 analogSig->set_zero_vpos(y);
450 _moveFlag = true;
451 traces_moved();
452 }
453 } else {
454 if (~QApplication::keyboardModifiers() & Qt::ControlModifier) {
455 const int y_snap =
456 ((y + View::SignalSnapGridSize / 2) /
457 View::SignalSnapGridSize) *
458 View::SignalSnapGridSize;
459 if (y_snap != t->get_v_offset()) {
460 _moveFlag = true;
461 t->set_v_offset(y_snap);
462 }
463 }
464 }
465 }
466 }
467 }
468 update();
469}
470

Callers

nothing calls this directly

Calls 10

is_workingMethod · 0.80
sessionMethod · 0.80
get_work_modeMethod · 0.80
get_deviceMethod · 0.80
emptyMethod · 0.80
get_v_offsetMethod · 0.80
set_v_offsetMethod · 0.80
endMethod · 0.45
get_typeMethod · 0.45
set_zero_vposMethod · 0.45

Tested by

no test coverage detected