Support for keyboard based control of FlowView (Q,W,E)
This commit is contained in:
@@ -79,6 +79,7 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
|
|
||||||
playbackTimer->setInterval(ui->spinPlayback->value()); //set the timer to the default value of the control
|
playbackTimer->setInterval(ui->spinPlayback->value()); //set the timer to the default value of the control
|
||||||
|
|
||||||
|
installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlowViewWindow::showEvent(QShowEvent* event)
|
void FlowViewWindow::showEvent(QShowEvent* event)
|
||||||
@@ -144,6 +145,36 @@ void FlowViewWindow::writeSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keyboard shortcuts to allow for quick work without needing to move around a mouse.
|
||||||
|
* E = resume or pause playback
|
||||||
|
* Q = go back one frame
|
||||||
|
* W = go forward one frame
|
||||||
|
*/
|
||||||
|
bool FlowViewWindow::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::KeyRelease) {
|
||||||
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
|
switch (keyEvent->key())
|
||||||
|
{
|
||||||
|
case Qt::Key_E:
|
||||||
|
if (playbackActive) btnPauseClick();
|
||||||
|
else btnPlayClick();
|
||||||
|
break;
|
||||||
|
case Qt::Key_Q:
|
||||||
|
btnBackOneClick();
|
||||||
|
break;
|
||||||
|
case Qt::Key_W:
|
||||||
|
btnFwdOneClick();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// standard event processing
|
||||||
|
return QObject::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FlowViewWindow::plottableDoubleClick(QCPAbstractPlottable* plottable, QMouseEvent* event)
|
void FlowViewWindow::plottableDoubleClick(QCPAbstractPlottable* plottable, QMouseEvent* event)
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ private:
|
|||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLOWVIEWWINDOW_H
|
#endif // FLOWVIEWWINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user