Qt World Summit: Register Today!

QWidget::showNormal() doesn't show window (Linux + Plasma)

  • I've encountered what I think is a bug, but the documentation isn't entirely clear.

    In the application I'm working on, we set the position and size of a window, then call QWidget::showNormal() to display it. On Ubuntu running Gnome, this consistently displays the window in the appropriate position and size. Same with macOS and Windows.

    I've been working under Kubuntu 18.04 (KDE Plasma 5.12.9) and on my system QMainWindow::showNormal() frequently (but not always) doesn't display the window. However QMainWindow::isVisible() returns true and QMainWindow::isHidden() similarly returns false. These methods check values of flags, so clearly QMainWindow::showNormal() is setting the flags to tell the window that it should be visible, it just never gets shown. It does receive a QShowEvent (we've subclassed QMainWindow::showEvent, all we do is pass the call to QMainWindow and emit a signal).

    Is showNormal() guaranteed to actually make the window visible? Or do I need to call show() (or setVisible()) first? I actually have tried this, it didn't work consistently. And if it's not guaranteed to make the window visible, why would it set the Qt::WA_WState_Visible and Qt::WA_WState_Hidden flags?

    I've also noticed this on Arch Linux over at least the last 6 months (kept up to date, so consistently with the latest stable Plasma release), so this isn't restricted to a particular version of Plasma. I also have Gnome installed on my Kubuntu system, and I can't reproduce the problem there. This seems to affect all Plasma 5 versions I've tried, and only Plasma.

  • Lifetime Qt Champion


    Does it happen with the Qt version installed by your distribution ?

  • @SGaist Good question. I'm not able to check this. We use a specific Qt version (5.15.3) to build our application, and it looks like the Qt5 dev version in Ubuntu 18.04 is 5.9.5. I won't be able to build with that. However, I don't think this is restricted to one Qt version. I have an older released version of our software built with Qt 5.9.4 and I'm able to reproduce the bug with that (again, only on Plasma).

  • Lifetime Qt Champion

    Can you reproduce that with a minimal example ?
    If it only happens in Plasma, you may have unearthed an issue there.

Log in to reply