fixed key events in goToFlow

TODO: add eventFilter to goToFlow edit...
This commit is contained in:
Luis Ángel San Martín
2013-12-10 23:37:29 +01:00
parent 883ac04917
commit 75e3d12f2e
10 changed files with 70 additions and 54 deletions

View File

@ -8,7 +8,7 @@
#include <QLabel>
#include <QPushButton>
#include <QMutex>
#include <QCoreApplication>
#include <QApplication>
#include <QLineEdit>
#include <QPushButton>
@ -71,6 +71,20 @@ GoToFlow::~GoToFlow()
worker->deleteLater();
}
void GoToFlow::keyPressEvent(QKeyEvent *event)
{
switch (event->key())
{
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
QApplication::sendEvent(flow,event);
return;
default:
break;
}
GoToFlowWidget::keyPressEvent(event);
}
void GoToFlow::centerSlide(int slide)
{
if(flow->centerIndex()!=slide)
@ -188,23 +202,6 @@ void GoToFlow::updateImageData()
updateTimer->stop();
}
bool GoToFlow::eventFilter(QObject *target, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
int key = keyEvent->key();
if((key==Qt::Key_Return)||
(key==Qt::Key_Enter)||
(key==Qt::Key_Space)||
(key==Qt::Key_Left)||
(key==Qt::Key_Right)||
(key==Qt::Key_S))
this->keyPressEvent(keyEvent);
}
return QWidget::eventFilter(target, event);
}
void GoToFlow::wheelEvent(QWheelEvent * event)
{
if(event->delta()<0)