Added preliminary mouse scrolling support for the waterfall and plot

area. As it stands, scrolling basically rotates the tuning knob. No
modifier keys are supported yet, but we'll get there!
merge-requests/1/merge
Elliott Liggett 2020-04-20 21:10:20 -07:00
rodzic f6d11f76bc
commit 03a3ca423d
2 zmienionych plików z 22 dodań i 0 usunięć

Wyświetl plik

@ -270,6 +270,9 @@ wfmain::wfmain(QWidget *parent) :
connect(wf, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handleWFDoubleClick(QMouseEvent*)));
connect(plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(handlePlotClick(QMouseEvent*)));
connect(wf, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(handleWFClick(QMouseEvent*)));
connect(wf, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handleWFScroll(QWheelEvent*)));
connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handlePlotScroll(QWheelEvent*)));
ui->plot->addGraph(); // primary
ui->plot->addGraph(0, 0); // secondary, peaks, same axis as first?
@ -1100,6 +1103,23 @@ void wfmain::handleWFClick(QMouseEvent *me)
showStatusBarText(QString("Selected %1 MHz").arg(x));
}
void wfmain::handleWFScroll(QWheelEvent *we)
{
// The wheel event is typically
// .y() and is +/- 120.
// We will click the dial once for every 120 received.
//QPoint delta = we->angleDelta();
// The minus is there because it felt more natural that way.
int steps = we->angleDelta().y() / 120;
ui->freqDial->setValue( ui->freqDial->value() - (steps)*ui->freqDial->singleStep() );
}
void wfmain::handlePlotScroll(QWheelEvent *we)
{
int steps = we->angleDelta().y() / 120;
ui->freqDial->setValue( ui->freqDial->value() - (steps)*ui->freqDial->singleStep() );
}
void wfmain::on_startBtn_clicked()
{
emit spectOutputEnable();

Wyświetl plik

@ -116,6 +116,8 @@ private slots:
void handlePlotDoubleClick(QMouseEvent *);
void handleWFClick(QMouseEvent *);
void handleWFDoubleClick(QMouseEvent *);
void handleWFScroll(QWheelEvent *);
void handlePlotScroll(QWheelEvent *);
void runDelayedCommand();
void showStatusBarText(QString text);