当前位置:网站首页>Currently clicked button and current mouse coordinates in QT judgment interface
Currently clicked button and current mouse coordinates in QT judgment interface
2022-07-05 06:11:00 【my_ angle2016】
1.QObject::sender( ) Returns the pointer of the object that sent the signal , The return type is QObject* . You can use qobject_cast The dynamic type is converted into the corresponding object of sending information ( The base class of the object class needs to have QObject).
QObject::objectName( ) Returns the name of the object (QString)
QPushButton*btn = qobject_cast<QPushButton*>(sender());// Get the object that transmits the signal
if(" Button object name "==btn->objectName()){// If you get an object
//...
}2. QMouseEvent Two kinds of coordinate systems , One is window coordinates ( Relative coordinates ), One is the display coordinates ( Global coordinates )
QPointQMouseEvent::globalPos();// Window coordinates , This is to return the global coordinates of the mouse
QPointQCursor::pos()[static];// Returns the global coordinates relative to the display
QPointQMouseEvent::pos();// Return relative to this widget The location of
QPointQWidget::pos();// This property gets the current position of the control in the parent window
constQPointF&QMouseEvent::screenPos()const;// and QPoint QMouseEvent::globalPos() Same value , But the type is more precise QPointF
QPointQWidget::mapToGlobal(constQPoint& pos)const;// Convert window coordinates into display coordinates
QPointQWidget::mapFromGlobal(constQPoint& pos)const;// Convert the display coordinates into window coordinates
QPointQWidget::mapToParent(constQPoint& pos)const;// Get the window coordinates pos Convert to parent class widget Coordinates of
QPointQWidget::mapFromParent(constQPoint& pos)const;// Convert the parent window coordinates to the current window coordinates
QPointQWidget::mapTo(constQWidget* parent,constQPoint& pos)const;// Convert the current window coordinates to the specified parent coordinate
// You can also use :
Qpoint pt=cursor().pos();// Get the current mouse position 边栏推荐
- [jailhouse article] performance measurements for hypervisors on embedded ARM processors
- leetcode-6110:网格图中递增路径的数目
- Data visualization chart summary (I)
- 智慧工地“水电能耗在线监测系统”
- Error ora-28547 or ora-03135 when Navicat connects to Oracle Database
- Doing SQL performance optimization is really eye-catching
- 1040 Longest Symmetric String
- 【实战技能】如何做好技术培训?
- 1.14 - 流水线
- Arduino 控制的 RGB LED 无限镜
猜你喜欢

MIT-6874-Deep Learning in the Life Sciences Week 7
![Introduction to LVS [unfinished (semi-finished products)]](/img/72/d5a943a8d6d71823dcbd7f23dda35b.png)
Introduction to LVS [unfinished (semi-finished products)]

数据可视化图表总结(二)

1.15 - 输入输出系统

1.13 - RISC/CISC
![[practical skills] technical management of managers with non-technical background](/img/4d/1081c71df6ee2087359111baf7498a.png)
[practical skills] technical management of managers with non-technical background

API related to TCP connection

Wazuh開源主機安全解决方案的簡介與使用體驗

Is it impossible for lamda to wake up?

网络工程师考核的一些常见的问题:WLAN、BGP、交换机
随机推荐
1039 Course List for Student
2022年貴州省職業院校技能大賽中職組網絡安全賽項規程
1040 Longest Symmetric String
leetcode-22:括号生成
快速使用Amazon MemoryDB并构建你专属的Redis内存数据库
Convolution neural network -- convolution layer
【Rust 笔记】15-字符串与文本(上)
Personal developed penetration testing tool Satania v1.2 update
TypeScript 基础讲解
Full Permutation Code (recursive writing)
Règlement sur la sécurité des réseaux dans les écoles professionnelles secondaires du concours de compétences des écoles professionnelles de la province de Guizhou en 2022
In depth analysis of for (VaR I = 0; I < 5; i++) {settimeout (() => console.log (I), 1000)}
中职网络安全技能竞赛——广西区赛中间件渗透测试教程文章
The connection and solution between the shortest Hamilton path and the traveling salesman problem
leetcode-6109:知道秘密的人数
开源存储这么香,为何我们还要坚持自研?
可变电阻器概述——结构、工作和不同应用
RGB LED infinite mirror controlled by Arduino
On the characteristics of technology entrepreneurs from Dijkstra's Turing Award speech
Brief introduction to tcp/ip protocol stack