问题描述
我有一个Qt对话框窗口,其中包含 QPlainTextEdit
小部件,为此我创建了一个软件输入面板(SIP),下面的例子。对话窗口的功能要求它保持在顶部。因此,SIP也必须保持在顶部 - 但是覆盖对话。我发现的问题是:
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:
- 如果我设置
Qt :: WindowStaysOnTopHint
- 如果我在SIP上只设置了
Qt :: WindowStaysOnTopHint
如果我在对话框和 SIP上设置Qt :: WindowStaysOnTopHint
,显然Qt :: WindowStaysOnTopHint
仅适用于一个窗口小部件。
- If I set
Qt::WindowStaysOnTopHint
on the dialog only the SIP falls behind it. - 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 setQt::WindowStaysOnTopHint
on the dialog and SIP, clearlyQt::WindowStaysOnTopHint
is applicable to one widget only.
可以做什么来确保对话框堆栈在这个顺序?使用SIP模态不是一个选择或良好的解决方案。
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.
如果重要的是我在C ++中编码
If it matters I'm coding in C++
PS
请参阅我对。
推荐答案
我找到了一个解决方法。我在SIP和主对话框上设置 Qt :: WindowStaysOnTopHint
,但是将SIP移动到主对话框的下面,以便SIP不被其遮挡。
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.
这篇关于Qt小部件和软件输入面板必须都保持在顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!