Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickItem::mousePressEvent() not called
Qt 6.11 is out! See what's new in the release blog

QQuickItem::mousePressEvent() not called

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
c++ qtc++ quicckitem
1 Posts 1 Posters 331 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Karim
    wrote on last edited by
    #1

    Hi all,

    I'm experiencing an issue with QQuickItem objects.
    Basically, I have an app with custom QMdiSubWindow.

    MyMdiSubWindow contains a QQuickWidget as its central widget.

    The QQuickWidget holds a MyObjectScene that inherits from
    QQuickItem. The purpose of this class is to store child items, selected child objects etc.

    MyObjectScene manages ElementItem objects.
    ElementItem inherits from QQuickPaintedItem.
    ElementItem overrides mousePressEvent() and mouseReleaseEvent().
    It works fine.

    However, sometime, when ElementItem rejects a mousePressEvent with
    event->ignore(), I would like MyObjectScene to intercept the event afterward in its
    mousePressEvent() handler.
    But it never happens.

    However, if I override MySubWindow::mousePressEvent() , I can catch the event.
    It means that, MySubWindow::mousePressEvent() is called when ElementItem::mousePressEvent ignores the event.

    What I need to do, is to have MyObjectScene::mousePressEvent() called instead of MySubWindow::mousePressEvent.

    Is there something wrong in this scenario ?

    Thanks for your feedback.

    Karim

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved