터치 스크린이있는 소형 ARM 임베디드 Linux 디바이스에서 Qt 4.8.3을 사용하고 있습니다. 터치 스크린을 tslib로 설정하고 조정 했으므로/etc /에 pointercal 파일이 있습니다. 내 터치 이벤트의 위치는 정상적으로 작동하지만 Mouse Press 또는 Mouse Release Events 전에 QEvent for Mouse Move를 얻을 수 있습니다. 또한 터치 스크린에서 손가락을 물리적으로 들어 올리기 전까지는 마우스 관련 이벤트가 발생하지 않습니다. 터치 스크린을 누르고 마우스 다운 이벤트가 발생하면 즉각적인 동작이 발생하고 내 이동 이벤트 (있을 경우)가 발생하고 마우스를 놓을 때 정상적인 동작이 필요합니다. 내가보고하고 내 응용 프로그램을 시작할 때, 이제Qt 임베디드 터치 스크린 QMouseEvents 수신되지 않음 MouseButtonRelease가 수신 될 때까지
/// For investigation mouse events
#include <QWSServer>
#include <QWSMouseHandler>
#include <QWSEvent>
bool GUIApp::qwsEventFilter(QWSEvent *e)
{
qDebug() << e->type;
if(e->type == QWSEvent::Mouse) {
QWSMouseHandler *curMouse = QWSServer::mouseHandler();
qDebug() << "mouse position is: " << curMouse->pos();
}
return false;
/*
QWSEvent::NoEvent 0 No event has occurred.
QWSEvent::Connected 1 An application has connected to the server.
QWSEvent::Mouse 2 A mouse button is pressed or released, or the mouse cursor is moved. See also Qt for Embedded Linux Pointer Handling.
*/
}
:
So what I'm seeing from the point of view of events received when I pressed down and then release looks like:
50 SockAct <-- Received right at press down
<-- NO Other events received until press released
<-- Now release by lifting finger from screen
50 SockAct <-- Immediately received a 50 (SockAct) and the rest of the events below:
2 <-- 2 == mouse down
2 <-- 2 == mouse down
3 <-- 3 == mouse release/up
3 <-- 3 == mouse release/up
77 <-- 77 == redraw
나는 또한 나의의 QApplication에 와서 QWS 이벤트를보기 위해 다음 qwsEventFilter을 구현하여 QWS Server 이벤트를보고 시도 화면을 터치 한 후 같은 동작 - 다음입니다 인쇄 :
2 <-- Nothing is printed until I release my finger from the screen!
mouse position is: QPoint(89,312)
2
mouse position is: QPoint(89,312)
당신은 아마도, 곧 내가이 사건을 얻을 내 손가락을 떼면 볼 아래로 눌러 해제 할 수있다.
Linux의/dev/input/touchscreen 장치에서 'evtest'를 실행했으며 화면을 누르면 즉시 터치 다운 이벤트가 표시됩니다. 손가락을 뗄 때까지 마우스 놓기 이벤트가 발생하지 않으므로 드라이버가 예상대로 작동합니다. 또한 누를 때 '반복'터치 다운 이벤트가 없습니다. 한 번의 누르기에 대해 하나의 이벤트이지만 올바르게 작동합니다.
나는 내가하는 행동을 왜보고 있는지 잘 모르겠습니다. Qt와 입력 장치 사이에 번역 문제가 있어야합니다.
내 MouseButtonRelease 이벤트 처리에 3ms 지연을 추가하면 앱이 작동하는 방식에 따라 원하는 동작을 얻지 만 언론에서 출시 될 때까지 마우스 이벤트를받지 못합니다. 지연을 추가 할 필요가 없습니다. 마우스를 놓고 마우스를 움직여야합니다.
이 문제를 해결하는 방법을 알고있는 사람이 있습니까? ? 고마워요!
-
나는 볼 수 없어 내가 실제로 내 손가락을 들어 올릴 때까지 인쇄 다음 :
: 여기...
MOVE TYPE: 5
"Mouse move (382,129)"
MOUSE BUTTON PRESS TYPE: 2
"Mouse Button Press (1)"
MOUSE BUTTON RELEASE TYPE: 3
"Mouse Button Release (1)"
....
가 내 앱에서 내받은 사건을 조사 내 eventFilter입니다
void Monitor::delay()
{
QTime dieTime = QTime::currentTime().addMSecs(3);
while(QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
다음은
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Just for kicks print out the mouse position
if (event->type() == QEvent::MouseButtonPress)
{
qDebug() << "MOUSE BUTTON PRESS TYPE: " << event->type();
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
qDebug() << QString("Mouse Button Press (%1)").arg(mouseEvent->button());
}
if (event->type() == QEvent::MouseMove)
{
qDebug() << "MOVE TYPE: " << event->type();
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
qDebug() << QString("Mouse move (%1,%2)").arg(mouseEvent->globalX()).arg(mouseEvent->globalY());
}
if (event->type() == QEvent::MouseButtonRelease)
{
qDebug() << "MOUSE BUTTON RELEASE TYPE: " << event->type();
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
delay();
qDebug() << QString("Mouse Button Release (%1)").arg(mouseEvent->button());
//return true; // Gobble the event
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
내 지연 기능입니다 0
마우스 이벤트를 처리하기 위해 [mouseMoveEvent] (https://qt-project.org/doc/qt-4.8/qwidget.html#mouseMoveEvent) 및 친구들을 다시 구현하지 않은 이유는 무엇입니까? –
Linux 콘솔의 atmel 터치 스크린 드라이버에서 evtest로 노출 된 것을 볼 때 Qt가 마우스 이벤트를 해석 할 것으로 예상했기 때문에 필자가 필요하다고 생각하지 않았습니다. – PhilBot
글쎄, 나는 당신의 셋업의 세부 사항을 알지 못하기 때문에 결정적인 것을 말할 수는 없지만 일반적인 Qt 관점에서 특정 이벤트 핸들러를 재 구현하는 것은 표준이다. [this thread] (http://lists.trolltech.com/qt-interest/2007-02/msg00428.html)에 따르면, 더 효율적입니다. Dunno가 당신의 문제와 관련이있다면, - 어쨌든, 어떤 객체를 설치할 것인가? –