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.
Thou shalt programme
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.
I use the following method to make an application remain on top of other windows in Qt:
SetWindowPos
(
(HWND)winId(),
HWND_TOPMOST,
window_top_pos,
window_left_pos,
window_width,
window_height,
SWP_SHOWWINDOW
);
Note that window_top_pos, window_left_pos, window_width and window_height are variables and you can replace them with your own.
Please be aware that this is a Win32 API function so it won’t work in Linux or MAC.
Don’t forget to add the include file to your code.
#include "windows.h"
And add the required library to your .PRO file.
LIBS += -luser32