Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Passing all mouse events from child to parent
Forum Updated to NodeBB v4.3 + New Features

Passing all mouse events from child to parent

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.2k 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.
  • D Offline
    D Offline
    Desperado17
    wrote on last edited by
    #1

    I have a QWidget with a layout where I add QWindow subwidgets created by
    QWidget::createWindowContainer.
    I want all mouse events to be processed by the parent.
    Currently I have to override the methods in the QWindow derived class and explicitly send them to the parent, bus is there a simpler method to cover all events?

    Regards

    1 Reply Last reply
    0
    • gde23G Offline
      gde23G Offline
      gde23
      wrote on last edited by
      #2

      you can use eventFilters for such a task:
      https://doc.qt.io/qt-5/qobject.html#installEventFilter

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Desperado17
        wrote on last edited by
        #3

        Thanks, I'll have a look at that.

        For some reason it seemed to work out of the box for regular QWidget types, is this normal?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Desperado17
          wrote on last edited by
          #4

          Ok, I now tried calling childWidget->installEventFilter(this) in the constructor of the parent widget. Also on the wrapped window directly. The parent does not receive events.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Desperado17
            wrote on last edited by
            #5

            QWidget doesn't really implement eventFilter method, right? Is implementing it on the parent and then just calling event() the right way?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Desperado17
              wrote on last edited by
              #6

              Apparently the QWindowContainer that createWindowContainer creates does receive the events the wrapped QWindow receives out of the box. Does anyone know how this class does it?

              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