Qt6 topics merged with General

How to raise a non-modal window over a QDialog?

  • I have a QMainWindow which is the main application window, and would like to show another QMainWindow, which is a help browser, when the user presses the F1 key. It is created with the application window as its parent object. This works nicely, and it is shown on top of the stack if only the main window or another QWidget-type window was open.

    But if I have opened a QDialog from the main window (using the exec() function) and then press F1, the help window opens, but it is hidden by the QDialog. Calling raise() on the help window has no effect; and if I try to use anything but the exec() function to open the dialog (i.e. open() or show()), the dialog is not shown at all.

    How can I raise the help browser above the dialogs in my application, keeping it non-modal so that the user can switch between viewing the dialog and the help topics? I am using Linux Ubuntu with the default GNOME window manager, but this should eventually run on Windows as well. Thanks!

  • Solved ... the reason I didn't see anything when calling the dialog's open() or show() functions was because I was creating it as a normal variable on the stack instead of with new. Now everything seems to work.

  • BTW, I marked this as SOLVED, got the SUCCESS notification from the web page, but the status hasn't changed yet AFAICT.

  • Lifetime Qt Champion


    Still the caching issue, it's marked properly. I see it as such.

Log in to reply