void Spectrum::mouseMoveEvent(QMouseEvent* event){ int move=event->pos().x()-lastX; lastX=event->pos().x(); // qDebug() << __FUNCTION__ << ": " << event->pos().x() << " move:" << move; moved=1; if(button==-1) { if(squelch && event->pos().y()>=(squelchY-1) && event->pos().y()<=(squelchY+1)) { showSquelchControl=true; this->setCursor(Qt::SizeVerCursor); } else { showSquelchControl=false; this->setCursor(Qt::ArrowCursor); } } else { if(settingSquelch) { int delta=squelchY-event->pos().y(); delta=int((float)delta*((float)(spectrumHigh-spectrumLow)/(float)height())); //qDebug()<<"squelchValueChanged"<<delta<<"squelchY="<<squelchY<<" y="<<event->pos().y(); emit squelchValueChanged(delta); //squelchY=event->pos().y(); } else { if (!move==0) emit frequencyMoved(move,100); } } }
void Spectrum::mouseMoveEvent(QMouseEvent* event){ int move=event->pos().x()-lastX; lastX=event->pos().x(); // qDebug() << __FUNCTION__ << ": " << event->pos().x() << " move:" << move; moved=1; if(button==-1) { if(squelch && event->pos().y()>=(squelchY-1) && event->pos().y()<=(squelchY+1)) { showSquelchControl=true; this->setCursor(Qt::SizeVerCursor); } else { showSquelchControl=false; this->setCursor(Qt::ArrowCursor); } } else { if(settingSquelch) { int delta=squelchY-event->pos().y(); delta=int((float)delta*((float)(spectrumHigh-spectrumLow)/(float)height())); //qDebug()<<"squelchValueChanged"<<delta<<"squelchY="<<squelchY<<" y="<<event->pos().y(); emit squelchValueChanged(delta); //squelchY=event->pos().y(); } else { float zoom_factor = 1.0f + zoom/25.0f; float move_ratio = (float)sampleRate/48000.0f/zoom_factor; int move_step; if (move_ratio > 10.0f) move_step = 500; else if (move_ratio > 5.0f) move_step = 200; else if (move_ratio > 2.5f) move_step = 100; else if (move_ratio > 1.0f) move_step = 50; else if (move_ratio > 0.5f) move_step = 10; else if (move_ratio > 0.25f) move_step = 5; else move_step = 1; if (!move==0) { if (subRx) emit frequencyMoved(-move,move_step); else emit frequencyMoved(move,move_step); } } } }