Important: Please read the Qt Code of Conduct -

QGraphicsWebView and CSS hover

  • Dear trolls,

    I have a QGraphicsWebView in the middle of a QGraphicsScene.

    I have an "hoverable" / "highligthable" item near the edge of my Web View.

    When I'm on this item and then quit suddenly the Web View the items stays in "CSS hover mode".

    Is there currently a way to avoid that (something like QWebPage::clearCSSHover()) ? Or is it a webkit specific issue ?



  • I can reproduce the issue. Alexis will have a look if he has time.

    If you want to work around it, I think you could send a fake mouse move event QWebPage, with a position outside the viewport (-100, -100).

  • Thanks Benjamin,

    By "send a fake mouse move event QWebPage" you mean send a fake mouse move event to the QWebPage::view() widget of the QWebPage ?

    Is it handled the same for a QGraphicsWebView ?

  • For the records, here is the workaround:
    @// In my subclassed QGraphicsWebView ...

    class WGraphicsWebView : public QGraphicsWebView

    WGraphicsWebView(WDeclarativeWebView * parent = 0);

    private: // Variables
    WDeclarativeWebView * parent;

    private: // Settings
    friend class WDeclarativeWebView;

    // And in my declarative item web view ...

    /* virtual */ void WDeclarativeWebView::hoverLeaveEvent(QGraphicsSceneHoverEvent * event)

    QGraphicsSceneMouseEvent viewEvent(QEvent::GraphicsSceneMouseMove);
    viewEvent.setPos(QPointF(-100, -100));


Log in to reply