【Qt】弹出子窗口时禁用主窗口
来源:互联网 发布:广州多迪网络靠谱吗 编辑:程序博客网 时间:2024/05/29 14:47
子窗口名:userManagerDialogQt::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.
- 【Qt】弹出子窗口时禁用主窗口
- QT QDialog如何弹出一个子窗口
- 弹出子窗口时设置主窗口不可点击
- QT 子窗口监听主窗口信号
- Javascript弹出子窗口
- js 弹出子窗口
- Flex4弹出子窗口
- Javascript弹出子窗口
- javascript 弹出子窗口
- JS弹出子窗口
- js 弹出子窗口
- JavaScript弹出子窗口
- 弹出子窗口
- QT 弹出窗口
- C# 弹出子窗口同时关闭主窗口
- Qt 主窗口点击按钮 弹出另一个自定义窗口
- Qt 弹出一个灰色半透明的子窗口,使主窗口上任何按键也点不了
- Qt|Qt禁用最大化按钮时最大化显示窗口
- HDU 4565 so easy ! 矩阵快速幂
- 微信小程序 获取openid 存入数据库 C#
- 百度Intern面试题之二叉树的网络传输及恢复--二叉树的文件存储和读取
- DOM编程-属性操作
- java参数传递
- 【Qt】弹出子窗口时禁用主窗口
- 【bzoj1109】 [POI2007]堆积木Klo
- 杂记——src与href区别
- 格式化输出LONGLONG类型
- 如何编写脚本对项目代码进行分析(测试篇)
- 设计模式--状态与策略模式
- Missing artifact mysql:mysql-connector-java:jar
- 备忘录模式
- 最终排名