QT学习笔记(十六):setwindowflags的属性总结
此枚举类型用于为小部件指定各种窗口系统属性。它们是不常用的,但在一些情况下是必要的。其中一些标志取决于底层窗口管理器是否支持它们。
主要类型有
enum WindowType {Widget = 0x00000000,Window = 0x00000001,Dialog = 0x00000002 | Window,Sheet = 0x00000004 | Window,Drawer = Sheet | Dialog,Popup = 0x00000008 | Window,Tool = Popup | Dialog,ToolTip = Popup | Sheet,SplashScreen = ToolTip | Dialog,Desktop = 0x00000010 | Window,SubWindow = 0x00000012,ForeignWindow = 0x00000020 | Window,CoverWindow = 0x00000040 | Window,WindowType_Mask = 0x000000ff,MSWindowsFixedSizeDialogHint = 0x00000100,MSWindowsOwnDC = 0x00000200,BypassWindowManagerHint = 0x00000400,X11BypassWindowManagerHint = BypassWindowManagerHint,FramelessWindowHint = 0x00000800,WindowTitleHint = 0x00001000,WindowSystemMenuHint = 0x00002000,WindowMinimizeButtonHint = 0x00004000,WindowMaximizeButtonHint = 0x00008000,WindowMinMaxButtonsHint = WindowMinimizeButtonHint | WindowMaximizeButtonHint,WindowContextHelpButtonHint = 0x00010000,WindowShadeButtonHint = 0x00020000,WindowStaysOnTopHint = 0x00040000,WindowTransparentForInput = 0x00080000,WindowOverridesSystemGestures = 0x00100000,WindowDoesNotAcceptFocus = 0x00200000,MaximizeUsingFullscreenGeometryHint = 0x00400000,CustomizeWindowHint = 0x02000000,WindowStaysOnBottomHint = 0x04000000,WindowCloseButtonHint = 0x08000000,MacWindowToolBarButtonHint = 0x10000000,BypassGraphicsProxyWidget = 0x20000000,NoDropShadowWindowHint = 0x40000000,WindowFullscreenButtonHint = 0x80000000
};
常用:
setWindowFlags(Qt::CustomizeWindowHint);//设置窗口标题栏自定义setWindowFlags(Qt::WindowMinimizeButtonHint);//设置窗口的标题栏只有最小化的按钮setWindowFlags(Qt::WindowCloseButtonHint);//设置窗口的标题栏只有关闭的按钮setWindowFlags(Qt::WindowStaysOnTopHint);//设置窗体一直置顶,并且不会抢焦点setWindowFlags(this->windowFlags());//设置窗口为QT的默认属性setWindowFlags(Qt::FramelessWindowHint));//设置窗体无边框,不可拖动拖拽拉伸setWindowModality(Qt::WindowModal); //设置窗体为模态
示例参考:
qt setWindowFlags各种标志位的窗口样式