Save widget from above in Qt

I am creating an application that has a floating widget that can be moved inside the application window. But it starts, or, as a rule, sometimes lags behind other widgets. Is there a way to make sure that the widget in my application stays on top of all other widgets when it becomes visible?

Thanks.

+4
source share
2 answers

Use the Qt::WindowStaysOnTopHint for your QWidget. This will make your widget stay on top of all other windows.

+4
source

You can call raise() in your widget so that it appears in front of all other child widgets of the parent in which it is located. If I read your question correctly, this is your behavior. However, any child that you create and add to the parent widget will be automatically placed above these widgets, so you may need to reinstall the widget after adding, or you might consider an alternative way to manage the parent / child relationships.

+3
source

Source: https://habr.com/ru/post/1304369/


All Articles