WindowSystemEvent

news/2024/11/19 15:14:30/文章来源:https://www.cnblogs.com/DesertCactus/p/18433446

Qt中为WindowSystemEvent事件定义了处理函数Handler,通过宏定义和模版来声明定义

---- QT_DEFINE_QPA_EVENT_HANDLER Matches (25 in 1 files) ----
qwindowsysteminterface.cpp (gui\kernel) line 199 : #define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...) \
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleLeaveEvent, QWindow *window)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleFocusWindowChanged, QWindow *window, Qt::FocusReason r)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowStates newState, int oldState)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowScreenChanged, QWindow *window, QScreen *screen)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowDevicePixelRatioChanged, QWindow *window)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleApplicationTermination)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleExposeEvent, QWindow *window, const QRegion &region)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handlePaintEvent, QWindow *window, const QRegion &region)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER in qwindowsysteminterface.cpp (gui\kernel) : QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window)

以MouseEvent为例:

template<>
template<typename EventType, typename ...Args>
bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent(Args ...args)
{QWindowSystemInterfacePrivate::windowSystemEventQueue.append(new EventType(args...));if (QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher())dispatcher->wakeUp();return true;
}template <typename EventType, typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ...Args>
static bool handleWindowSystemEvent(Args ...args)
{return QWindowSystemHelper<Delivery>::template handleEvent<EventType>(args...);
}#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...) \template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::DefaultDelivery>(__VA_ARGS__); \template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::SynchronousDelivery>(__VA_ARGS__); \template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::AsynchronousDelivery>(__VA_ARGS__); \template<typename Delivery> ReturnType QWindowSystemInterface::HandlerName(__VA_ARGS__)QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,const QPointF &local, const QPointF &global, Qt::MouseButtons state,Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,Qt::MouseEventSource source)
{unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
}QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointingDevice *device,const QPointF &local, const QPointF &global, Qt::MouseButtons state,Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,Qt::MouseEventSource source)
{unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();return handleMouseEvent<Delivery>(window, time, device, local, global, state, button, type, mods, source);
}QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,const QPointF &local, const QPointF &global, Qt::MouseButtons state,Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,Qt::MouseEventSource source)
{return handleMouseEvent<Delivery>(window, timestamp, QPointingDevice::primaryPointingDevice(),local, global, state, button, type, mods, source);
}QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,const QPointF &local, const QPointF &global, Qt::MouseButtons state,Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,Qt::MouseEventSource source)
{bool isNonClientArea = {};switch (type) {case QEvent::MouseButtonDblClick:case QEvent::NonClientAreaMouseButtonDblClick:Q_ASSERT_X(false, "QWindowSystemInterface::handleMouseEvent","QTBUG-71263: Native double clicks are not implemented.");return false;case QEvent::MouseMove:case QEvent::MouseButtonPress:case QEvent::MouseButtonRelease:isNonClientArea = false;break;case QEvent::NonClientAreaMouseMove:case QEvent::NonClientAreaMouseButtonPress:case QEvent::NonClientAreaMouseButtonRelease:isNonClientArea = true;break;default:Q_UNREACHABLE();}auto localPos = QHighDpi::fromNativeLocalPosition(local, window);auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window);return handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, Delivery>(window,timestamp, localPos, globalPos, state, mods, button, type, source, isNonClientArea, device);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/804061.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基础数据结构之递归

递归 1) 概述 定义 计算机科学中,递归是一种解决计算问题的方法,其中解决方案取决于同一类问题的更小子集In computer science, recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same probl…

JAVA的数组基本用法

array 在声明数组变量时,需要指出数组类型和数组变量名,例如int[] a;不过这条语句只是声明了变量a,并没有将a初始化为一个真正的数组。应该使用new操作符来创建数组。 int[] a = int[100]或者var a = new int[100]数组长度不要求是常数 但是一旦创建了数组,就不能再改变它的…

Unity DatePicker用法,实现UI的日期/时间选择器功能

前言 用Unity3d做一个类似于选时间段,查询数据并展示统计UI的功能 插件 https://assetstore.unity.com/packages/tools/gui/datepicker-for-unityui-68264 样例效果 弹出日期选择器时间范围选择器包含类型 Shared Calendar 共享的日历,这个就是几个选择器共用一个日历来选择时…

正三棱台

正三棱台的相关知识点前情概要 正三棱台的概念,表面积,体积公式,引申 动态演示结合上图,你能说出正三棱台的各部分的名称吗?你能自行画出正三棱台的图形吗? 典例剖析 【2025届高三质检一试题】已知正三棱台 \(ABC-A_1B_1C_1\) 的上底面积为 \(\sqrt{3}\),下底面积为 \(4…

【VMware vCenter】升级到 vCenter Server 8.0 U3b 后 vSphere Client 出现卡死和不响应等问题的解决方法。

最近 VMware 发布了 VMSA-2024-0019 安全通告,更新并修复了 CVE-2024-38812 和 CVE-2024-38813 编号中发现的 vCenter Server 漏洞,可能很多人都已经更新了,我也将自己的实验环境更新到了说明中所修复的版本,vCenter Server 8.0 U3b,内部版本号 24262322。但是,更新之后使…

vscode设置python解释器以及函数无法点击跳转问题

1.下载插件 1.1 Python1.2 Pylance1.3 Remote-SSH2.设置本地/远程python解释器 2.1本地设置 2-1-1 设置解释器路径设置自定义python解释器路径,mac快捷键command + p> python: select interpreter选择或者输入解释器2-1-2 查看设置结果设置完python-venv路径后,打开py脚本…

老毛子、H大固件wan口修改为lan口

事由 因路由器只有一个wan口两个lan口。无线桥接(非AP模式)之后wan口也就没有用了,两个lan口也不够我用,索性将wan桥接为lan。另外:解释一下为何说我桥接不说修改,修改对外行对结果来说的状态,内部命令行专业来说其实就是桥接命令 需求和操作结果 wan口修改为lan口、无线…

布客沉思录(二)合伙人的不作为以及GenAI的新机会

合伙人的不作为————需要做但是没有做的规划翻译并校对了 FreeLearning VKDoc iBooker 三个系列技术教程 √ 制作大量源码解析 √ 制作了视频合成工具 √ 制作了大量玄学视频,普及玄学知识 √ 制作了大量量化教程 √ 探索并实现了开放式两性关系 √ 制作大量视频普及开放式…

第一次结对作业

这个作业属于哪个课程 软件工程2024这个作业要求在哪里 2024秋软件工程结对作业(第一次之需求分析和原型设计)这个作业的目标 学习使用原型软件,辅助完成软件工程的前期任务学号 102201427结对成员学号:102201427、102201426 原型链接:Find You Team一、阅读《构建之法》后…

decimal,float和double的区别是什么?

原文链接:https://blog.csdn.net/hellojoy/article/details/118105569 表示小数的一共有三种类型:float是单精度,double是双精度,decimal是数字型,它们所占的内存空间不一样,表示的位数也不一样。 1、精度:float单精度小数部分能精确到小数点后面6位,用 32 位二进制进…

布客沉思录(二)合伙人的不作为和背叛

合伙人需要做但是没有做的规划翻译并校对了 FreeLearning VKDoc iBooker 三个系列技术教程 √ 制作大量源码解析 √ 制作了视频合成工具 √ 制作了大量玄学视频,普及玄学知识 √ 制作了大量量化教程 √ 探索并实现了开放式两性关系 √ 制作大量视频普及开放式关系和红丸 量化策…

MT5016A-ASEMI三相整流桥MT5016A

MT5016A-ASEMI三相整流桥MT5016A编辑:ll MT5016A-ASEMI三相整流桥MT5016A 型号:MT5016A 品牌:ASEMI 封装:D-63 批号:2024+ 类型:三相整流桥 电流(ID):50A 电压(VF):1600V 安装方式:直插式封装 特性:大功率、整流方桥 产品引线数量:4 产品内部芯片个数:4 产品内部…