Qt之Gui
组件依赖关系

应用
QApplication:widget对应的应用
QGuiApplication :gui对应的应用
QCoreApplication :无gui对应的应用
widget
QPlatformIntegration:平台抽象
QPlatformWindow :平台 抽象窗口
windows平台
在QWindowsIntegration创建createPlatformWindow时,其先创建QWindowsWindowData::create
QWindowsWindowDataWindowCreationData::create(const QWindow *w, const WindowData &data, QString title) const
{WindowData result;result.flags = flags;const auto appinst = reinterpret_cast<HINSTANCE>(GetModuleHandle(nullptr));const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w);const QScreen *screen{};const QRect rect = QPlatformWindow::initialGeometry(w, data.geometry,defaultWindowWidth, defaultWindowHeight,&screen);if (title.isEmpty() && (result.flags & Qt::WindowTitleHint))title = topLevel ? qAppName() : w->objectName();const auto *titleUtf16 = reinterpret_cast<const wchar_t *>(title.utf16());const auto *classNameUtf16 = reinterpret_cast<const wchar_t *>(windowClassName.utf16());// Capture events before CreateWindowEx() returns. The context is cleared in// the QWindowsWindow constructor.const QWindowCreationContextPtr context(new QWindowCreationContext(w, screen, data.geometry,rect, data.customMargins,style, exStyle));QWindowsContext::instance()->setWindowCreationContext(context);const bool hasFrame = (style & (WS_DLGFRAME | WS_THICKFRAME));QMargins invMargins = topLevel && hasFrame && QWindowsGeometryHint::positionIncludesFrame(w)? invisibleMargins(QPoint(context->frameX, context->frameY)) : QMargins();qCDebug(lcQpaWindows).nospace()<< "CreateWindowEx: " << w << " class=" << windowClassName << " title=" << title<< '\n' << *this << "\nrequested: " << rect << ": "<< context->frameWidth << 'x' << context->frameHeight<< '+' << context->frameX << '+' << context->frameY<< " custom margins: " << context->customMargins<< " invisible margins: " << invMargins;QPoint pos = calcPosition(w, context, invMargins);// Mirror the position when creating on a parent in RTL mode, ditto for the obtained geometry.int mirrorParentWidth = 0;if (!w->isTopLevel() && QWindowsBaseWindow::isRtlLayout(parentHandle)) {RECT rect;GetClientRect(parentHandle, &rect);mirrorParentWidth = rect.right;}if (mirrorParentWidth != 0 && pos.x() != CW_USEDEFAULT && context->frameWidth != CW_USEDEFAULT)pos.setX(mirrorParentWidth - context->frameWidth - pos.x());result.hwnd = CreateWindowEx(exStyle, classNameUtf16, titleUtf16,style,pos.x(), pos.y(),context->frameWidth, context->frameHeight,parentHandle, nullptr, appinst, nullptr);qCDebug(lcQpaWindows).nospace()<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "<< context->obtainedPos << context->obtainedSize << ' ' << context->margins;if (!result.hwnd) {qErrnoWarning("%s: CreateWindowEx failed", __FUNCTION__);return result;}if (mirrorParentWidth != 0) {context->obtainedPos.setX(mirrorParentWidth - context->obtainedSize.width()- context->obtainedPos.x());}QRect obtainedGeometry(context->obtainedPos, context->obtainedSize);result.geometry = obtainedGeometry;result.fullFrameMargins = context->margins;result.embedded = embedded;result.hasFrame = hasFrame;result.customMargins = context->customMargins;return result;
}
内部会先注册registerWindowClass,设置窗口的处理函数registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);
qWindowsWndProc处理函数主要是调用 QWindowsContext的windowsProc
QString QWindowsContext::registerWindowClass(QString cname,WNDPROC proc,unsigned style,HBRUSH brush,bool icon)
{// since multiple Qt versions can be used in one process// each one has to have window class names with a unique name// The first instance gets the unmodified name; if the class// has already been registered by another instance of Qt then// add a UUID. The check needs to be performed for each name// in case new message windows are added (QTBUG-81347).const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));WNDCLASS wcinfo;const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE&& wcinfo.lpfnWndProc != proc;if (classExists)cname += QUuid::createUuid().toString();if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our listreturn cname;WNDCLASSEX wc;wc.cbSize = sizeof(WNDCLASSEX);wc.style = style;wc.lpfnWndProc = proc;wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.hInstance = appInstance;wc.hCursor = nullptr;wc.hbrBackground = brush;if (icon) {wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));if (wc.hIcon) {int sw = GetSystemMetrics(SM_CXSMICON);int sh = GetSystemMetrics(SM_CYSMICON);wc.hIconSm = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0));} else {wc.hIcon = static_cast<HICON>(LoadImage(nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));wc.hIconSm = nullptr;}} else {wc.hIcon = nullptr;wc.hIconSm = nullptr;}wc.lpszMenuName = nullptr;wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16());ATOM atom = RegisterClassEx(&wc);if (!atom)qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.",qPrintable(cname));d->m_registeredWindowClassNames.insert(cname);qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << ' ' << cname<< " style=0x" << Qt::hex << style << Qt::dec<< " brush=" << brush << " icon=" << icon << " atom=" << atom;return cname;
}
相关文章:
Qt之Gui
组件依赖关系 应用 #mermaid-svg-GADicZtZJRVVUeiF {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-GADicZtZJRVVUeiF .error-icon{fill:#552222;}#mermaid-svg-GADicZtZJRVVUeiF .error-text{fill:#552222;stroke:#…...
Linux操作系统之进程信号
进程信号 一、信号1、概念2、系统定义的信号列表3、常见的信号处理方式 二、产生信号的方式1、终端按键(1)组合键(2)示例代码(3)运行结果 2、调用系统函数(1)kill命令(2&…...
科普文:微服务之Spring Cloud Alibaba消息队列组件RocketMQ工作原理
概叙 本文探讨 RocketMQ 的事务消息原理,并从源码角度进行分析,以及事务消息适合什么场景,使用事务消息需要注意哪些事项。 同时详细介绍RocketMQ 事务消息的基本流程,并通过源码分析揭示了其内部实现原理,尽管事务消…...
黑马头条vue2.0项目实战(五)——首页—频道编辑
目录 1. 使用页面弹出层 1.1 页面弹出层简单使用 1.2 创建频道编辑组件 1.3 页面布局 2. 展示我的频道 3. 展示推荐频道列表 3.1 获取所有频道 3.2 处理展示推荐频道 4. 添加频道 5. 编辑频道 5.1 处理编辑状态 5.2 切换频道 5.3 让激活频道高亮 5.4 删除频道 6.…...
Java:基础语法
基础语法 1. 基本结构类和方法 2. 变量和数据类型基本数据类型引用数据类型 3. 操作符算术操作符比较操作符逻辑操作符 4. 控制结构条件语句循环语句 5. 数组6. 方法7. 面向对象编程类和对象继承多态 8. 异常处理9. 常用类库 1. 基本结构 类和方法 Java程序的基本单位是类&am…...
安装bedtools详细步骤和详细介绍bedtools用法
安装bedtools详细步骤和详细介绍bedtools用法 一、安装bedtools详细步骤下载解压安装编译依赖编译设置环境变量激活环境变量执行命令查看版本二、详细介绍bedtools用法使用bedtools示例用法bedtools intersectbedtools bamtobedbedtools window一、安装bedtools详细步骤 下载 …...
21 - grace数据处理 - 补充 - 泄露误差改正 - Slepian局部谱分析法(一) - slepian分析法理论理解
21 - grace数据处理 - 泄露误差改正 - Slepian局部谱分析法 - slepian分析法理论理解 0 引言1 slepian谱分析法1.1 slepian谱分析法AI解释1.2 基于slepian谱分析法的GRACE数据处理应用2 slepian谱分析法关键过程实现2.1 求解正定特征方程2.2 计算slepian基函数2.3 计算Shannon数…...
WLAN国家码与信道顺从表
国家码和信道顺从表及信道功率限制 不同的国家和地区规定了在本国或本地区可以使用的信道、射频信号在信道中的最大发射功率。工作在不同信道的射频信号,信号强度可能会有差别。国家码和信道顺从表、各信道的功率限制值、信道编号和频率对照关系请参见国家码和信道…...
行为型设计模式1:状态/策略/命令
行为型设计模式:状态/策略/命令 (qq.com)...
【知识专栏丨python数分实战】天猫订单数据分析及可视化|taobao天猫订单接口
今天这篇文章将给大家介绍天猫订单数据分析及可视化案例。 import pandas as pdimport numpy as npfrom pyecharts.charts import Pie,Bar,Line,Map,Map3D,Funnelfrom pyecharts import options as optsimport matplotlib.pyplot as pltimport warningsimport seaborn as snsfr…...
[kimi笔记]为什么csc.exe不可以双击运行
csc.exe 是 C# 编译器的可执行文件,它是 .NET Framework 的一部分,用于编译 C# 源代码文件( .cs 文件)生成可执行文件( .exe 文件)或其他类型的程序集。 csc.exe 不能通过双击运行的原因有以下几点&…...
护眼大路灯哪个牌子好?2024学生护眼大路灯推荐
护眼大路灯哪个牌子好?护眼大路灯不仅能够提供日常的光线照明,还模拟了太阳光光线,使在室内用眼学习也能够有着自然光般的舒适感,但现在市场上有许多对产品质量把控不过关、光线效果欠佳、存有安全隐患的劣质护眼大路灯产品&#…...
Vue项目中手搓滑动校验模块-demo
实现代码 SliderCheck.vue <template><div class"drag" ref"dragDiv"><div class"drag_bg" ref"dragBg"></div><div class"drag_text" ref"dragText">{{ confirmWords }}</di…...
Socket如何实现客户端和服务器间的通信
Socket 是实现网络通信的一种机制,它允许在不同主机之间的进程通过网络进行数据交换。下面我将简要介绍如何使用 Socket 实现客户端和服务器间的通信。 客户端-服务器通信步骤: 服务器端: 创建服务器端 Socket: 服务器端通过创…...
基于Spring boot + Vue的校园论坛
作者的B站地址:程序员云翼的个人空间-程序员云翼个人主页-哔哩哔哩视频 csdn地址:程序员云翼-CSDN博客 1.项目技术栈: 前后端分离的项目 后端:Springboot MybatisPlus 前端:Vue ElementUI 数据库: …...
RabbitMQ高级特性 - 生产者消息确认机制
文章目录 生产者消息确认机制概述confirm 代码实现return 代码实现 生产者消息确认机制 概述 为了保证信息 从生产者 发送到 队列,因此引入了生产者的消息确认机制. RabbitMQ 提供了两种解决方案: 通过事务机制实现.通过发送确认机制(confi…...
webpack的loader机制
webpack的loader机制 loader本质上就是导出函数的JavaScript模块。导出的函数,可以用来实现内容的转换。 /* * param{string|Buffer} content 源文件的内容 * param{object} [map] SourceMap数据 * param{any} [meta] meta数据,可以是任何数据 * */ fu…...
(STM32笔记)十一、通过EXTI外部中断实现 按键控制LED
我用的是正点的STM32F103来进行学习,板子和教程是野火的指南者。 之后的这个系列笔记开头未标明的话,用的也是这个板子和教程。 十一、通过EXTI外部中断实现 按键控制LED 十一、通过EXTI外部中断实现 按键控制LED1、按键模块按键原理图按键程序思路 2、中…...
假如家里太大了,wifi连不上了怎么办
最近有个土豪朋友抱怨,他家里太大了,一个路由器的Wi-Fi信号根本无法覆盖他们家的每个房间,都没办法上网看奥运会比赛了。(还好我是穷人,就没有这种烦恼T_T)。 然后我问他为何不用一个路由器作主路由器&…...
elementPlus 设置el-input文本域固定高度和禁止下拉
elementPlus 设置el-input文本域固定高度和禁止下拉 话不多说直接上代码 // resize"none" 禁止下拉<el-inputv-model"textarea"style"width: 240px"type"textarea"resize"none"placeholder"请输入"/>// 设…...
vscode里如何用git
打开vs终端执行如下: 1 初始化 Git 仓库(如果尚未初始化) git init 2 添加文件到 Git 仓库 git add . 3 使用 git commit 命令来提交你的更改。确保在提交时加上一个有用的消息。 git commit -m "备注信息" 4 …...
synchronized 学习
学习源: https://www.bilibili.com/video/BV1aJ411V763?spm_id_from333.788.videopod.episodes&vd_source32e1c41a9370911ab06d12fbc36c4ebc 1.应用场景 不超卖,也要考虑性能问题(场景) 2.常见面试问题: sync出…...
SciencePlots——绘制论文中的图片
文章目录 安装一、风格二、1 资源 安装 # 安装最新版 pip install githttps://github.com/garrettj403/SciencePlots.git# 安装稳定版 pip install SciencePlots一、风格 简单好用的深度学习论文绘图专用工具包–Science Plot 二、 1 资源 论文绘图神器来了:一行…...
Docker 运行 Kafka 带 SASL 认证教程
Docker 运行 Kafka 带 SASL 认证教程 Docker 运行 Kafka 带 SASL 认证教程一、说明二、环境准备三、编写 Docker Compose 和 jaas文件docker-compose.yml代码说明:server_jaas.conf 四、启动服务五、验证服务六、连接kafka服务七、总结 Docker 运行 Kafka 带 SASL 认…...
什么?连接服务器也能可视化显示界面?:基于X11 Forwarding + CentOS + MobaXterm实战指南
文章目录 什么是X11?环境准备实战步骤1️⃣ 服务器端配置(CentOS)2️⃣ 客户端配置(MobaXterm)3️⃣ 验证X11 Forwarding4️⃣ 运行自定义GUI程序(Python示例)5️⃣ 成功效果 核心…...
回溯算法学习
一、电话号码的字母组合 import java.util.ArrayList; import java.util.List;import javax.management.loading.PrivateClassLoader;public class letterCombinations {private static final String[] KEYPAD {"", //0"", //1"abc", //2"…...
【无标题】路径问题的革命性重构:基于二维拓扑收缩色动力学模型的零点隧穿理论
路径问题的革命性重构:基于二维拓扑收缩色动力学模型的零点隧穿理论 一、传统路径模型的根本缺陷 在经典正方形路径问题中(图1): mermaid graph LR A((A)) --- B((B)) B --- C((C)) C --- D((D)) D --- A A -.- C[无直接路径] B -…...
[大语言模型]在个人电脑上部署ollama 并进行管理,最后配置AI程序开发助手.
ollama官网: 下载 https://ollama.com/ 安装 查看可以使用的模型 https://ollama.com/search 例如 https://ollama.com/library/deepseek-r1/tags # deepseek-r1:7bollama pull deepseek-r1:7b改token数量为409622 16384 ollama命令说明 ollama serve #:…...
