Reputation: 4499
For two QWindow W1 & W2.
Is there a way to make W2 always on top of W1?
The current method I use is to set W2 always on top by Qt::WindowStaysOnTopHint
.
But it also block the modal dialog when the dialog appear behind the window. How can I make sure W2 on top of W1 without blocking the modal dialog?
I use QWindow because W2 is a QQuickView, which is not QWidget.
I am working on windows.
Upvotes: 2
Views: 1001
Reputation: 1085
w2->setTransientParent(w1);
If you also want to change w2
's appearance and behaviour, use QWindow::setFlags
.
But it may have side effects. E.g. w2 is closed on w1 close.
Upvotes: 1
Reputation: 11732
Try this:
window->setWindowModality(Qt::WindowModal);
You may have to first call this, while the window isn't shown yet, and then call show()
on your window, as mentioned here.
Upvotes: 0