子窗口名: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.

【Qt】弹出子窗口时禁用主窗口相关推荐

  1. C#弹出ContextMenuStrip菜单时禁用某些选项

    C#弹出ContextMenuStrip菜单时禁用某些选项 //菜单弹出前根据条件禁用某些菜单 private void CmsRoomRightBtn_Opening(object sender, ...

  2. QT弹出子窗口隐藏任务栏

    Qt开发界面程序时,有时需要弹出子窗口,但弹出子窗口时任务栏会多出一个图标,这样就不符合美观了,例如: 弹了的子窗口也会在任务栏那里显示 那么如果只显示在界面上,不显示在任务栏中了,我们需要设置Win ...

  3. QT学习笔记(六)——QT弹出对话框并在主窗口调用对话框的信息

    QT弹出对话框并在主窗口调用对话框的信息,显示影像 最近封控,大部分时间都在自己学习写代码,有点feel 了哈,自己摸出来一个简单的qt 界面,也实现了自己想要的功能.本篇博客主要记录一下,如何弹出对 ...

  4. [PYQT5] 主窗口弹出子窗口

    需求: 在PYQT5中,点击主窗口中的按钮,弹出子窗口. 测试代码: 例1: 在主窗口添加按钮,并把按钮信号关联槽,在槽函数中创建子窗口对象赋值到普通变量,并调用其 show 方法. from PyQ ...

  5. 在PYQT5中,点击主窗口中的按钮,弹出子窗口

    目录 例1: 例2: 例3: 例4: 需求: 在PYQT5中,点击主窗口中的按钮,弹出子窗口. 测试代码: 例1: from PyQt5.QtWidgets import * import syscl ...

  6. Tkinter 实现弹出子窗口并冻结主窗口

    简介 用Tkinter实现自动弹出子窗口并冻结主窗口,子窗口设置按钮,可以解除或者冻结主窗口,效果如下: 代码 import sys import tkinter from tkinter impor ...

  7. java弹框刷新原页面_JavaScript:关闭弹出窗口时刷新父窗口

    说明: 关闭弹出窗口时刷新父窗口也可以说是关闭子窗口时自动刷新父窗口中的信息,即用户通过window对象的open()方法打开一个新窗口(子窗口),当用 户在该子窗口中进行了数据库操作(如数据添加.修 ...

  8. QT 在子窗口中调用主窗口的UI

    在QT中,我们时常会需要在主窗口里添加一些子窗口,比如添加一个新的对话框,或者在TabWidget中添加tab页面.通常添加子窗口后,如果在子窗口中做了一些操作,我们需要在主窗口中通过UI控件反映出来 ...

  9. Qt应用程序主窗口之一:主窗口框架

    对于日常见到的应用程序而言,许多都是基于主窗口的,主窗口中包含了菜单栏.工具栏.状态栏和中心区域等.这一章会详细介绍主窗口的每一个部分,还会涉及资源管理.富文本处理.拖放操作和文档打印等相关内容.重点 ...

最新文章

  1. gps84转换gcj02公式_地球坐标系 (WGS-84) 相互转火星坐标系 (GCJ-02) 的转换算法
  2. 具体分析Struts工作流程
  3. ctrl+Enter 自动加上 .com 而不是 .com.cn
  4. APPium-Xpath,swipe练习
  5. 抽象类可以用new创建对象吗_宠物可以用人类的湿巾吗?猫咪有泪痕可以用纸巾擦掉吗?...
  6. 工控软件IFIX加入WEB显示图表
  7. yum安装jdk1.8
  8. python可以下载百度文库_用Python爬取百度文库0下载券的免费文档详细步骤,附可执行软件...
  9. bittorrent_最好的免费BitTorrent客户
  10. 小测试整理(含T1 T2)
  11. matlab 生成Blocks和Heavysine等典型非线性非平稳信号代码
  12. 【带你看看开源圈的新趋势】GITHUB OCTOVERSE 2022 详细解读
  13. 立法保护关键信息基础设施意义重大
  14. java图片文字自动识别
  15. (配对问题)一个屋子有一个门(门是关闭的)和3盏电灯。屋外有3个开关,分别与这3盏灯相连
  16. [ 深度学习平台 ] —— Google Colab : 开源GPU的配置与使用
  17. 《大数据+AI在大健康领域中最佳实践前瞻》---- 医疗知识库的未来形态:医疗知识图谱前瞻
  18. L1-043 阅览室 (C语言)
  19. 查看计算机的快捷键被哪些占用,windows系统找出全局快捷键被占用情况的方法...
  20. 另一个代码重用的著名bug -- 阿丽亚娜5型火箭的杯具处/女秀

热门文章

  1. parameter缩略语_常用参数缩写
  2. Python Selenium爬虫实现歌曲免费下载
  3. IMX6 GT9XX 10.1寸触摸屏移植
  4. echarts-gl 使用出现错误
  5. 什么是monkey patch(猴子补丁)
  6. 594. 最长和谐子序列--Python
  7. 【IoT】NFC 之 M1 非接触式 IC 卡性能浅析(S50)
  8. VGA接口复习笔记(原理,时序)VGA接口FPGA实现
  9. 泛微OA E9后端环境搭建(IDEA) Ecology 9二次开发环境搭建 ecology二次开发
  10. Docker容器启动参数大全与详细说明