add small minimum time between taps to onboarding (#23212)

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh
2021-12-13 17:38:19 -08:00
committed by GitHub
parent f482354e4e
commit df5b374033
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -16,6 +16,11 @@ TrainingGuide::TrainingGuide(QWidget *parent) : QFrame(parent) {
}
void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) {
if (click_timer.elapsed() < 250) {
return;
}
click_timer.restart();
if (boundingRect[currentIndex].contains(e->x(), e->y())) {
if (currentIndex == 9) {
const QRect yes = QRect(692, 842, 492, 148);
@@ -40,6 +45,7 @@ void TrainingGuide::showEvent(QShowEvent *event) {
currentIndex = 0;
image.load(img_path + "step0.png");
click_timer.start();
}
void TrainingGuide::paintEvent(QPaintEvent *event) {
+2
View File
@@ -1,5 +1,6 @@
#pragma once
#include <QElapsedTimer>
#include <QImage>
#include <QMouseEvent>
#include <QPushButton>
@@ -74,6 +75,7 @@ private:
QString img_path;
QVector<QRect> boundingRect;
QElapsedTimer click_timer;
signals:
void completedTraining();