Congratulations to our 2022 Qt Champions!

Event handler does not get fired after postEvent

  • Hi,
    I have a MDI application. I'll show some widget asynchronously, the code is something as below,
    It runs fine if I have a few Views. However, if 10+ views get opened, "QMyWidget::customEvent" will not be fired, even I have posted the event. Are there somebody have clues?

    void QMyWidget::Show()
    QApplication::postEvent(this, new QEvent(ShowEvent));

    void QMyWidget::customEvent(QEvent *event)
    if (event->type() == ShowEvent)
    // show myself

  • What's the value of ShowEvent?

  • const QEvent::Type ShowEvent = QEvent::User;

  • Could you mock up a simple fully working example that shows the exact problem you're having (and use the code tags when posting it)? Of course you can also tar/zip it.

    Based on gut feeling I'd say that the event loop is being flooded.

Log in to reply