【Qt】弹出子窗口时禁用主窗口
转载: https://blog.csdn.net/kaspar1992/article/details/75984022
子窗口名:userManagerDialog
Qt::WindowFlags flags = Qt::Dialog;
userManagerDialog->setWindowFlags(flags);
弹出子窗口时禁用主窗口
userManagerDialog->setWindowModality(Qt::ApplicationModal); //阻塞除当前窗体之外的所有的窗体
关于setWindowFlag的解释:
Window flags are a combination of a type (e.g. Qt::Dialog) and zero or more hints to the window system (e.g.Qt::FramelessWindowHint).
If the widget had type Qt::Widget or Qt::SubWindow and becomes a window (Qt::Window,Qt::Dialog, etc.), it is put at position (0, 0) on the desktop. If the widget is a window and becomes aQt::Widget orQt::SubWindow, it is put at position (0, 0) relative to its parent widget.
Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must callshow() to make the widget visible again..
Access functions:
Qt::WindowFlags |
windowFlags() const |
void |
setWindowFlags(Qt::WindowFlags type) |
关于setWindowModality的解释:
This property holds which windows are blocked by the modal widget.
This property only makes sense for windows. A modal widget prevents widgets in other windows from getting input. The value of this property controls which windows are blocked when the widget is visible. Changing this property while the window is visible has no effect; you must hide() the widget first, thenshow() it again.
By default, this property is Qt::NonModal.
This property was introduced in Qt 4.1.
Access functions:
Qt::WindowModality |
windowModality() const |
void |
setWindowModality(Qt::WindowModalitywindowModality) |
This enum specifies the behavior of a modal window. A modal window is one that blocks input to other windows. Note that windows that are children of a modal window are not blocked.
The values are:
Constant |
Value |
Description |
Qt::NonModal |
0 |
The window is not modal and does not block input to other windows. |
Qt::WindowModal | 1 | The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows. |
Qt::ApplicationModal | 2 | The window is modal to the application and blocks input to all windows. |
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- three.js 着色器材质之纹理
- three.js 制作属于自己的动态二维码
- three.js 制作机房(上)
- three.js 将图片马赛克化
- three.js 数学方法之Box3
- three.js 数学方法之Plane
- three.js 制作机房(下)
- three.js 着色器材质内置变量
- three.js 数学方法之Vector3
- three.js 数学方法之Matrix3
- three.js 对象绕任意轴旋转--模拟门转动
- three.js UV映射简述
- three.js 数学方法之Matrix4
- three.js 利用uv和ThreeBSP制作一个快递柜
- three.js 欧拉角和四元数