mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 15:04:40 -04:00
fixed key events in goToFlow
TODO: add eventFilter to goToFlow edit...
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user