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

  • 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?

  • this might help:

    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)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.