added returnshortcut in racewinow

This commit is contained in:
2014-12-23 21:40:23 +01:00
parent 417ba5d231
commit 955c19b778
2 changed files with 25 additions and 0 deletions

View File

@@ -2,9 +2,11 @@
#include "ui_windowrace.h"
#include <QObject>
#include <string>
#include <QShortcut>
#include <sstream>
#include <iostream>
#include "unistd.h"
#include <QKeySequence>
using std::vector;
using std::string;
@@ -118,7 +120,29 @@ WindowRace::WindowRace(DataBase *db, QWidget *parent) :
this->ui->pbTime->setStyleSheet("QProgressBar::chunk { color: #05B8CC;}");
this->ui->pbTime->setValue(0);
QKeySequence ks(Qt::Key_Return); // btw, this is numpad enter
QShortcut *keyReturn = new QShortcut(ks, this);
QObject::connect(keyReturn, SIGNAL(activated()), this, SLOT(ReturnPress()));
//QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(close()));
}
void WindowRace::ReturnPress(){
//cout << "Return pressed" << endl;
if(this->ui->pBNextRace->isEnabled()){
this->prepareNextRace();
}
else{
if(started){
this->breakCounter();
}
else{
this->go();
}
}
}
void WindowRace::prepareNextRace(){
this->firstTimeShell = true;
this->firstTimeDea = true;

View File

@@ -69,6 +69,7 @@ public slots:
void laufcheck();
void deaSlot();
void shellSlot();
void ReturnPress();
};
#endif // WINDOWRACE_H