Qt如何去掉系统提供的窗口边框

1、直接去掉系统提供的窗口边框,不能移动和改变窗口的大小。

setWindowFlags(Qt::FramelessWindowHint);

Qt::FramelessWindowHint: Produces a borderless window. The user cannot move or resize a borderless window via the window system. On X11, the result of the flag is dependent on the window manager and its ability to understand Motif and/or NETWM hints. Most existing modern window managers can handle this.

2、如果隐藏边框后还想要把该界面至于其他界面的顶层,可以使用以下代码:

this->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);

3、隐藏任务栏中的图标:

this->setWindowFlags(Qt::Tool);

你可能感兴趣的:(Qt学习笔记)