0
votes

I've got a Qt dialog window that contains a QPlainTextEdit widget, for which I've created a Software Input Panel (SIP), following the example here. The function of the dialog window requires it to remain on top. As such, the SIP too must remain on top -- but overlaying the dialog. The problem I find is that:

  1. If I set Qt::WindowStaysOnTopHint on the dialog only the SIP falls behind it.
  2. If I set Qt::WindowStaysOnTopHint on the SIP only the dialog window that can now be eclipsed by other windows, same thing happens if I set Qt::WindowStaysOnTopHint on the dialog and SIP, clearly Qt::WindowStaysOnTopHint is applicable to one widget only.

What can be done to ensure that the dialogs stack in this order? Making the SIP modal is not really an option or good solution.

If it matters I'm coding in C++

PS Please take a look at my follow on question as well.

2
Does the SIP have a parent? Is the dialog modal? Which OS and desktop environment are you using?Frank Osterfeld
OS, Windows 7. The other questions were answerd in my post. The SIP is not modal, and is created by and InputPanelContext object as shown in the example.Olumide
I meant the other dialog, not the SIP. I don't see where you mention parenting (important as that affects the stacking order).Frank Osterfeld
The parent dialog is the main window.Olumide

2 Answers

0
votes

Looks like the problem is that the MyInputPanel QWidget is being constructed with Qt::Tool flag. The purpose of that flag is to ensure that a window ALWAYS appears on top of any other windows which is not what you want.

0
votes

I've found a workaround. I set Qt::WindowStaysOnTopHint on the SIP and main dialog, but move the SIP just below the main dialog, so that the SIP is not occluded by it.