How to Make Your Window Stay on Top in Qt

You can use the following snippet to make your MainWindow or any other window always on top:

setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);

Just insert it in your window’s constructor function.