Qt窗口设置Z方向的层叠顺序
方法1:在ui 文件中设置
在UI文件中,设置Z方向的层叠顺序,只能将窗口放到其父窗口的最上面,或者放到父窗口的最下面。
见下图:

方法2:在cpp中通过代码实现
(1)将窗口置顶
[slot] void QWidget::raise()
Raises this widget to the top of the parent widget’s stack.
After this call the widget will be visually in front of any overlapping sibling widgets.
Note: When using activateWindow(), you can call this function to ensure that the window is stacked on top.
(2)将窗口放到最底层
[slot] void QWidget::lower()
Lowers the widget to the bottom of the parent widget’s stack.
After this call the widget will be visually behind (and therefore obscured by) any overlapping sibling widgets.
(3)将窗口放到某个窗口之下
void QWidget::stackUnder(QWidget *w)
Places the widget under w in the parent widget’s stack.
To make this work, the widget itself and w must be siblings.
402



被折叠的 条评论
为什么被折叠?



