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. How to pass a QEvent to a QWidget's child widgets?

How to pass a QEvent to a QWidget's child widgets?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k 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.
  • B Offline
    B Offline
    billconan
    wrote on last edited by
    #1

    Hello,

    I want to automatically generate some QMouseEvent and let a QMainWindow widget to handle it. I'm currently using QCoreApplication::sendEvent(QObject * receiver, QEvent * event)
    function. But this function can only let the receiver (QMainWindow) to handle the event, it doesn't propagate the event to the receiver's child widgets.

    For example, in my QMainWindow, I have buttons and text fields and other components. When I send mouseEvent to the QMainWindow, I want the widget whose bounding box overlaps the event's location handles the event. But with the QCoreApplication::sendEvent function, I can only let the QMainWindow handles it.

    How do I propagate an event to a widget's child widgets?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Buckets
      wrote on last edited by
      #2

      this might help:
      http://qt-project.org/doc/qt-5.0/qtcore/signalsandslots.html

      If you want to do like a mouse over event on a QPushButton you will have to implement that yourself.

      However if you want something in a widget to call a function you just have to use the appropriate sender, SIGNAL(trigger), reciever, SLOT(func)

      ba ba ba
      ba na na na

      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