pkFingerPrintManager::pkFingerPrintManager()
{
}
// ... CUT ...
void pkFingerPrintManager::notifyInputEvent(int dx, int dy, int state)
{
if (this->isNavigateRunning())
{
m_dx += dx;
m_dy += dy;
if (m_dx >= PK_FPM_KEY_THRESHOLD)
{
this
->processKeyEvent
(QEvent::KeyPress, Qt
::Key_Right,
0,
true,
false);
m_dx = 0;
}
if (m_dx <= -PK_FPM_KEY_THRESHOLD)
{
this
->processKeyEvent
(QEvent::KeyPress, Qt
::Key_Left,
0,
true,
false);
m_dx = 0;
}
if (m_dy >= PK_FPM_KEY_THRESHOLD)
{
this
->processKeyEvent
(QEvent::KeyPress, Qt
::Key_Down,
0,
true,
false);
m_dy = 0;
}
if (m_dy <= -PK_FPM_KEY_THRESHOLD)
{
this
->processKeyEvent
(QEvent::KeyPress, Qt
::Key_Up,
0,
true,
false);
m_dy = 0;
}
if (dx == 0)
m_dx = 0;
if (dy == 0)
m_dy = 0;
}
}
pkFingerPrintManager::pkFingerPrintManager()
: QWSKeyboardHandler()
{
QWSServer::setKeyboardHandler(this);
}
// ... CUT ...
void pkFingerPrintManager::notifyInputEvent(int dx, int dy, int state)
{
if (this->isNavigateRunning())
{
m_dx += dx;
m_dy += dy;
if (m_dx >= PK_FPM_KEY_THRESHOLD)
{
this->processKeyEvent(QEvent::KeyPress, Qt::Key_Right, 0, true, false);
m_dx = 0;
}
if (m_dx <= -PK_FPM_KEY_THRESHOLD)
{
this->processKeyEvent(QEvent::KeyPress, Qt::Key_Left, 0, true, false);
m_dx = 0;
}
if (m_dy >= PK_FPM_KEY_THRESHOLD)
{
this->processKeyEvent(QEvent::KeyPress, Qt::Key_Down, 0, true, false);
m_dy = 0;
}
if (m_dy <= -PK_FPM_KEY_THRESHOLD)
{
this->processKeyEvent(QEvent::KeyPress, Qt::Key_Up, 0, true, false);
m_dy = 0;
}
if (dx == 0)
m_dx = 0;
if (dy == 0)
m_dy = 0;
}
}
To copy to clipboard, switch view to plain text mode
void TestWidget
::keyPressEvent(QKeyEvent* event
) {
if (event->key() == Qt::Key_Left)
{
// ...
event->accept();
return;
}
if (event->key() == Qt::Key_Right)
{
// ...
event->accept();
return;
}
// ...
event->ignore();
}
void TestWidget::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Left)
{
// ...
event->accept();
return;
}
if (event->key() == Qt::Key_Right)
{
// ...
event->accept();
return;
}
// ...
event->ignore();
}
To copy to clipboard, switch view to plain text mode
Bookmarks