取消窗口边框
取消掉窗口边框,不能移动和放大、缩小窗口
this->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.
窗口居中显示
1、添加头文件
#include <QDesktopWidget>
2、需要居中窗口的构造函数中添加
QDesktopWidget *desktop = QApplication::desktop();
move((desktop->width()-this->width())/2,(desktop->height()-this->height())/2);
图解:

783

被折叠的 条评论
为什么被折叠?



