After addWidget, eventFilter suddenly doesn't work.
-
@Pl45m4
This line is only for testing catch events. I originally wanted to catch a specific event, but it always failed.EventFilter cannot catch any kind of events.
-
@John-Van said in After addWidget, eventFilter suddenly doesn't work.:
this->installEventFilter(this);
What's the purpose for this line?
You usually don't set an event filter for yourself, since the widget gets all the events anyway and you could handle them in their native event handler.m_widget = new DWidget(this); ui.vLayout->addWidget(m_widget); this->installEventFilter(this);
The eventFilter doesn't working,eventFilter cannot intercept any events.
What kind of events? I suspect other widgets to take the events before your filter receives them.
-
@John-Van said in After addWidget, eventFilter suddenly doesn't work.:
this->installEventFilter(this);
What's the purpose for this line?
You usually don't set an event filter for yourself, since the widget gets all the events anyway and you could handle them in their native event handler.m_widget = new DWidget(this); ui.vLayout->addWidget(m_widget); this->installEventFilter(this);
The eventFilter doesn't working,eventFilter cannot intercept any events.
What kind of events? I suspect other widgets to take the events before your filter receives them.
-
@Pl45m4
This line is only for testing catch events. I originally wanted to catch a specific event, but it always failed.EventFilter cannot catch any kind of events.
-