MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / mouseMoveEvent

Method mouseMoveEvent

DSView/pv/view/viewport.cpp:788–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787
788void Viewport:: mouseMoveEvent(QMouseEvent *event)
789{
790 assert(event);
791 _hover_hit = false;
792 int mode = _view.session().get_device()->get_work_mode();
793
794 if (event->buttons() & Qt::LeftButton) {
795 if (_type == TIME_VIEW) {
796 if (_action_type == NO_ACTION) {
797 int64_t x = _mouse_down_offset + (_mouse_down_point - event->pos()).x();
798 _view.set_scale_offset(_view.scale(), x);
799 }
800 _drag_strength = (_mouse_down_point - event->pos()).x();
801 }
802 else if (_type == FFT_VIEW) {
803 for(auto t: _view.session().get_spectrum_traces()) {
804 if(t->enabled()) {
805 double delta = (_mouse_point - event->pos()).x();
806 t->set_offset(delta);
807 break;
808 }
809 }
810 }
811 }
812
813 if (_type == TIME_VIEW) {
814 if ((event->buttons() & Qt::LeftButton) ||
815 !(event->buttons() | Qt::NoButton)) {
816 if (_action_type == DSO_TRIG_MOVE) {
817 if (_drag_sig && _drag_sig->signal_type() == SR_CHANNEL_DSO) {
818 view::DsoSignal *dsoSig = (view::DsoSignal*)_drag_sig;
819 dsoSig->set_trig_vpos(event->pos().y());
820 _dso_trig_moved = true;
821 }
822 }
823
824 if (_action_type == CURS_MOVE) {
825 TimeMarker* grabbed_marker = _view.get_ruler()->get_grabbed_cursor();
826 if (grabbed_marker) {
827 int curX = _view.hover_point().x();
828 uint64_t index0 = 0, index1 = 0, index2 = 0;
829 bool logic = false;
830
831 for(auto s : _view.session().get_signals()) {
832 if (mode == LOGIC && s->signal_type() == SR_CHANNEL_LOGIC) {
833 view::LogicSignal *logicSig = (view::LogicSignal*)s;
834 if (logicSig->measure(event->pos(), index0, index1, index2)) {
835 logic = true;
836 break;
837 }
838 }
839 if (mode == DSO && s->signal_type() == SR_CHANNEL_DSO) {
840 view::DsoSignal *dsoSig = (view::DsoSignal*)s;
841 curX = min(dsoSig->get_view_rect().right(), curX);
842
843 if (curX < dsoSig->get_view_rect().left()){
844 curX = dsoSig->get_view_rect().left();
845 }

Callers

nothing calls this directly

Calls 15

get_work_modeMethod · 0.80
get_deviceMethod · 0.80
sessionMethod · 0.80
set_scale_offsetMethod · 0.80
scaleMethod · 0.80
set_offsetMethod · 0.80
signal_typeMethod · 0.80
set_trig_vposMethod · 0.80
get_grabbed_cursorMethod · 0.80
get_rulerMethod · 0.80
pixel2indexMethod · 0.80
index2pixelMethod · 0.80

Tested by

no test coverage detected