Hi there!

I am seeing a QEvent::TouchBegin being sent to the QGraphicsView viewport (on 
Mac) when moving the mouse into or out of the view with no buttons pressed. I 
noticed this because if a QLineEdit somewhere else on the window, and then I 
move the mouse over the view, the line edit loses focus within the last line in 
the following code block in Application::notify, where “widget” is the 
QGraphicsView viewport.

At other times this same block is called (indicating a TouchBegin event) when I 
simply move the mouse outside the view again.

What gives? The stack trace doesn’t include the generation of the touch event 
so I can’t infer the conceptual policy here. Seems like line edit should at 
least retain focus when not clicking or dragging anywhere.

Thank you!

    case QEvent::TouchBegin:
    // Note: TouchUpdate and TouchEnd events are never propagated
    {
        QWidget *widget = static_cast<QWidget *>(receiver);
        QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e);
        bool eventAccepted = touchEvent->isAccepted();
        bool acceptTouchEvents = 
widget->testAttribute(Qt::WA_AcceptTouchEvents);

        if (acceptTouchEvents && e->spontaneous()) {
            const QPoint localPos = 
touchEvent->touchPoints()[0].pos().toPoint();
            QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, 
localPos);
        }

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to