qt - QMainWindow stops receiving QEvent::UpdateRequest when user opens menu or resizes window -
mywindow inherits qmainwindow. mywindow contains qglwidget displays animation.
the problem animation pauses whenever open menu or resize window.
the animation implemented calling qcoreapplication::postevent(this, new qevent(qevent::updaterequest))
periodically, calling redrawing each time window receives qevent::updaterequest
, this:
bool mywindow::event(qevent *event) { qdebug() << event; switch (event->type()) { case qevent::updaterequest: render(); return true; default: return qmainwindow::event(event); } }
as seen qdebug()
, while menu open or window being resized, window stops receiving update request events.
is there setting on qmainwindow/qwidget make continue receive update request events? or there better way implement animation?
edit: i'm on mac os x.
this may qt bug. i'll investigate.
alas, you're way overcomplicating code.
the
postevent
should replacedthis->update()
. behind scenes posts event you.one can connect qtimer instance's signal
widget, slot(update())
. if want save onqobject
instance, useqbasictimer
, reimplementtimerevent
follows:void mywidget::timerevent(qtimerevent* ev) { if (ev.timerid() == m_timer.timerid()) update(); }
there's no need deal
event()
reimplementation. reimplementpaintevent()
- that's it's for.
Comments
Post a Comment