kopia lustrzana https://gitlab.com/eliggett/wfview
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
rodzic
f6d11f76bc
commit
03a3ca423d
20
wfmain.cpp
20
wfmain.cpp
|
@ -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();
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -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);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue