Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to pass a QEvent to a QWidget's child widgets?
billconan last edited by
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?
Buckets last edited by
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)