Qt touchscreen
linux上QtChart的触屏缩放和移动

linux上QtChart的触屏缩放和移动linux多点触摸配置:exportQWS_MOUSE_PROTO=evdevtouch:/dev/input/event15 export QT_QPA_EDEV_MOUSE_PARAMETERS=abs 注意:编译Qt时需配置以支持多点触控如下:实现曲线的单指移动,双手缩放,双击恢复ChartView {id:chartViewtitle: "Series Demo"anchors.fill: parentlegend.visible: falseantialiasing: trueproperty double seYproperty double m_Aproperty double m_Bproperty double m_aproperty double m_bproperty double tproperty double intvproperty double cntproperty double distanceX :0.0property double distanceY :0.0property double scaleOffset: 1property double scrollLeftValue: 0property double scrollUpValue: 0property int touchStartTime: 0property int touchEndTime: 0property int times: 0function getCurrentTime(){var time = new Date();var ms = time.getSeconds() * 1000 + time.getMilliseconds(); return ms;}ValueAxis {id: axisXmin: 0max: 1000tickCount: 13titleText: "t"labelFormat: "%d"titleFont.pixelSize: controls.isHigh?20:12labelsFont.pixelSize: controls.isHigh?20:12}ValueAxis {id: axisYmin: -0.5max: 1.5tickCount:9titleText: "℃"labelFormat: "%d"titleFont.pixelSize: controls.isHigh?20:12labelsFont.pixelSize: controls.isHigh?20:12}LineSeries {id: series1axisX: axisXaxisY: axisYuseOpenGL: truename: qsTr("示例曲线")}ScatterSeries {id: series2axisX: axisXaxisY: axisY}MultiPointTouchArea{anchors.fill: parent// mouseEnabled: falsetouchPoints: [TouchPoint{id:point1},TouchPoint{id:point2}]onPressed: {chartView.times += 1if(chartView.times == 1){chartView.touchStartTime = chartView.getCurrentTime();}}onGestureStarted: {chartView.times = 0;if(point2.previousX == point2.x && point2.previousY== point2.y)//单指触摸,移动{chartView.distanceX = point1.x - point1.previousX;chartView.distanceY = point1.y - point1.previousYchartView.scrollLeft(chartView.distanceX)chartView.scrollUp(chartView.distanceY)chartView.scrollLeftValue = chartView.distanceX + chartView.scrollLeftValue ;chartView.scrollUpValue =chartView.distanceY + chartView.scrollUpValue;}else{var disPreY = Math.abs(point2.previousY- point1.previousY) var disY = Math.abs(point2.y - point1.y)var temp =disY - disPreYif(temp > 0){if(chartView.scaleOffset < 1)chartView.scaleOffset = 1;chartView.scaleOffset += temp/5000 ;}else{if(chartView.scaleOffset > 1)chartView.scaleOffset = 1;chartView.scaleOffset += temp/5000;}chartView.zoom(chartView.scaleOffset )}}onReleased: {if(chartView.times == 2){chartView.touchEndTime = chartView.getCurrentTime();if(chartView.touchEndTime - chartView.touchStartTime < 300)//计算两次点击的实际间隔,小于300ms则认为是双击{chartView.zoomReset()axisX.min = 0axisX.max = chartView.taxisY.min = -Math.ceil(Math.abs(chartView.m_A)+Math.abs(chartView.m_B));axisY.max = Math.ceil(Math.abs(chartView.m_A)+Math.abs(chartView.m_B));}chartView.times = 0;}}}}Component.onCompleted: {chartView.t = 0;chartView.intv=0.01;/doc/2914132562.html,t = 2000;chartView.m_A=3;chartView.m_B=4;chartView.m_a=5;chartView.m_b=6;axisY.min = -Math.ceil(Math.abs(chartView.m_A)+Math.abs(chartView.m_B));axisY.max = Math.ceil(Math.abs(chartView.m_A)+Math.abs(chartView.m_B));axisX.min = 0for (var i = 0; i <=/doc/2914132562.html,t; i++) { chartView.seY =chartView. m_A * Math.sin(2*3.14*chartView.m_a * chartView.t) + chartView.m_B * Math.sin(2*3.14*chartView.m_b * chartView.t)series1.append(chartView.t, chartView.seY);// series2.append(chartView.t, chartView.seY);chartView.t+=chartView.intv;}axisX.max = chartView.t}。
Qt的第三章

(8) 向导对话框
略
5 其他窗口部件
(1) QFrame类族 包含QLabel、QLCDNumber、QSplitter、 QStackedWidget、QToolBox、 QAbstractScrollArea等。
公共属性: 通过设置FrameShape、FrameShadow、 LineWidth、MidLineWidth参数组合,形成 不同的效果。
(1)颜色对话框 QColorDialog 作用:用户可选择颜色并获得对应的值 方法一(使用类静态函数): QColor color=QColorDialog::getColor() 方法二(创建类对象):
QColorDialog dialog(Qt::red,this); dialog.setOption(QColorDialog::ShowAlphaChannel); dialog.exec(); QColor color = dialog.currentColor();
(2)文件对话框 QFileDialog 作用:用户选择文件或文件夹 打开文件: QFileDialog::getOpenFileName() 保存文件: QFileDialog::getSaveFileName()
(3)字体对话框 QFontDialog 作用:用户和选择字体 获得字体: QFont font = QFontDialog::getFont()
2)QCheckBox、QRadioButton、QGroupBox 常用函数: isChecked():判断是否被选中
注:一组单选框(RadioButton)常放置在 相同的GroupBox中,实现单选功能。
飞凌2440QT移植

QT4移植到FL2440开发板的详细过程(转载并加以修改)不知道是大家的系统环境不同还是网友们打错字了,我在网上找了不下十篇有关QT移植的文档。
文档大部分相同,但有一些不一样,但我全都试了,都有一些小问题!后来我一篇文档为主,其他文档为辅,对比错误,修改文档,得出这个适合我自己移植QT的完整版,这供大家参考!因为我的板子是飞凌的2440开发板。
网上关于qt4移植到飞凌2440的文章并不是很多,其中移植这部分我也走了很多弯路,遇到很多问题,但最后还是搞出来了,其实这过去也有快一个月了,那个时候也没时间写文章,但为了跟大家一同学习,今天特花了点时间把前面的经验写下来,希望能帮到各位,好了下面就开始我们的移植之旅吧!一、系统环境(蓝色是我的配置)宿主机:window xp sp3虚拟机linux centOS 或者fedora9,10linux编译器(交叉编译器):arm-linux-gcc 3.4.1开发板:飞凌2440--LCD 3.5寸系统linux-2.6.24(2.6.28也可以)2.6.12文件系统为yaffs系统所需软件包:arm-linux-gcc-3.4.1.tar.bz2 下载地址:/download/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2qt-embedded-linux-opensource-src-4.5.3.tar.gz下载地址大家到网上搜一下就出来了。
tslib-1.4.tar.gz(用于触摸验证)说明:说明一下这里为什么选择这些软件,首先fl2440板子需要编译器可以是2.95.3也可以使3.4.1这里我只是试了这两个,可能其他的也可以。
而qt/embeded则是我随便下了一个。
补充:这里为了说的完整些,我把qt的各版本也给大家说一下,关于Qt,Qt/E,Qtopia Core, Qtopia。
Qt泛指Qt的所有桌面版本,比如Qt/X11,Qt Windows,Qt Mac等。
Qt5在ARM平台移植的关键技术实现

Qt5在ARM平台移植的关键技术实现作者:王春阳张家坤杨海涛来源:《数码设计》2018年第02期摘要:随着科技的进步,越来越多的软件平台不断对自己的平台进行更新和优化,使得平台功能越来越强大,操作越来越简便。
然而Qt5在更新过程中忽略了对tslib与传统c++编程的屏幕翻转支持。
针对Qt5在ARM平台无法实现屏幕旋转和tslib触控失灵的问题,本文提出了相应的解决方法。
针对屏幕无法旋转问题,使用Graphics View框架在Qt窗口设计时就更改其显示方向,然后移植到ARM平台就可实现窗口的翻转。
针对tslib触控失灵问题,使用Qt5最新的环境变量开启tslib模块支持,并且额外增加一个tslib库。
经实际验证以上方法完全解决相应问题。
关键字:Qt5;屏幕旋转;tslib中图分类号:TP3-05 文献标识码:A 文章编号:1672-9129(2018)02-0001-02Qt5 in the Realization of Key Technology of the ARM Platform TransplantationWANG Chunyang*, ZHANG Jiakun, YANG Haitao(college of computer Science and Engineering, Northern University for nationalities,Ningxia Yinchuan, 750021, China)Abstract:With the progress of science and technology, more and more software platforms continue to update and optimize their platforms, making platform functions more powerful and easier to operate.However, Qt5 overlooked screen flip support for tslib and traditional c++ programming during the update process.In view of the problem that Qt5 can not achieve screen rotation and tslib touch control in some ARM platforms, this paper proposes a corresponding solution.The screen cannot rotate, using Graphics View framework in Qt window design is to change its display direction, and then transplanted to the ARM platform can realize the window flipping.For tslib touch failure, tslib module support is opened with the latest Qt5 environment variables, and an additional tslib library is required.The above method has been proved to be a complete solution to the corresponding problems.Keywords:Qt5; tslib; Screen rotation引用:王春阳,张家坤,杨海涛. Qt5在ARM平台移植的关键技术实现[J]. 数码设计,2018, 7(2): 1-1.Cite:WANG Chunyang, ZHANG Jiakun, YANG Haitao. Qt5 in the Realization of Key Technology of the ARM Platform Transplantation[J]. Peak Data Science, 2018, 7(2): 1-1.引言随着嵌入式系统的发展,在Linux下使用Qt开发嵌入式图形用户界面是嵌入式应用的重点[1]。
触摸屏校准方法

嵌入式Linux和MiniGUI结合的解决方案已经成为很多嵌入式系统的图形化方案之一,而触摸屏也是很多嵌入式系统首选的输入设备,因此触摸屏的校准也成为很多嵌入式系统开发过程中常常碰到的问题之一。
嵌入式Linux是一种可以进行裁减、修改使之能在嵌入式计算机系统上运行的操作系统,既继承了Internet上的无限的开放源代码资源,又具有嵌入式操作系统的特性。
该系统具有较高的稳定性和安全性、良好的硬件支持、标准兼容性和资源丰富等功能。
而触摸屏是一种方便、快捷的输入设备,附着在显示器的表面,与显示器配合使用,在工业控制场合得到了广泛的应用。
然而在实际的嵌入式程序移植的过程中,由于触摸屏尺寸的不同,以及GUI(Graphic User Interface)方案选择和IAL(Input Abstract Layer)的差异,一般开发板制造商并不提供触摸屏的校正程序。
本文介绍的正是笔者在制作实际的嵌入式Linux数控机床人机接口过程中,提出的一套基于嵌入式Linux和MiniGUI的通用触摸屏校准程序设计方案。
MiniGUI简介MiniGUI()是国内最有影响的自由软件项目之一, MiniGUI 项目的目标是为基于 Linux 的实时嵌入式系统提供一个轻量级的图形用户界面支持系统。
该项目自1998年底开始到现在,已历经7年多的开发过程,到目前为止,已经比较成熟和稳定,并且在许多实际产品或项目中得到了广泛应用。
MiniGUI 为应用程序定义了一组轻量级的窗口和图形设备接口。
利用这些接口,每个应用程序可以建立多个窗口,而且可以在这些窗口中绘制图形且互不影响。
用户也可以利用MiniGUI 建立菜单、按钮、列表框等常见的 GUI 元素。
MiniGUI 可以具有两种截然不同的运行时模式:MiniGUI-Threads或者MiniGUILite。
运行在 MiniGUI-Threads 上的程序可以在不同的线程中建立多个窗口,但所有的窗口在一个进程中运行。
触摸屏校准方法

嵌入式Linux和MiniGUI结合的解决方案已经成为很多嵌入式系统的图形化方案之一,而触摸屏也是很多嵌入式系统首选的输入设备,因此触摸屏的校准也成为很多嵌入式系统开发过程中常常碰到的问题之一。
嵌入式Linux是一种可以进行裁减、修改使之能在嵌入式计算机系统上运行的操作系统,既继承了Internet上的无限的开放源代码资源,又具有嵌入式操作系统的特性。
该系统具有较高的稳定性和安全性、良好的硬件支持、标准兼容性和资源丰富等功能。
而触摸屏是一种方便、快捷的输入设备,附着在显示器的表面,与显示器配合使用,在工业控制场合得到了广泛的应用。
然而在实际的嵌入式程序移植的过程中,由于触摸屏尺寸的不同,以及GUI(Graphic User Interface)方案选择和IAL(Input Abstract Layer)的差异,一般开发板制造商并不提供触摸屏的校正程序。
本文介绍的正是笔者在制作实际的嵌入式Linux数控机床人机接口过程中,提出的一套基于嵌入式Linux和MiniGUI的通用触摸屏校准程序设计方案。
MiniGUI简介MiniGUI()是国内最有影响的自由软件项目之一, MiniGUI 项目的目标是为基于 Linux 的实时嵌入式系统提供一个轻量级的图形用户界面支持系统。
该项目自1998年底开始到现在,已历经7年多的开发过程,到目前为止,已经比较成熟和稳定,并且在许多实际产品或项目中得到了广泛应用。
MiniGUI 为应用程序定义了一组轻量级的窗口和图形设备接口。
利用这些接口,每个应用程序可以建立多个窗口,而且可以在这些窗口中绘制图形且互不影响。
用户也可以利用MiniGUI 建立菜单、按钮、列表框等常见的 GUI 元素。
MiniGUI 可以具有两种截然不同的运行时模式:MiniGUI-Threads或者MiniGUILite。
运行在 MiniGUI-Threads 上的程序可以在不同的线程中建立多个窗口,但所有的窗口在一个进程中运行。
qtscrcpy使用方法
qtscrcpy使用方法一、介绍qtscrcpy是一款基于Qt和adb的屏幕镜像显示和控制工具,它可以将安卓设备的屏幕内容投射到电脑上,并且可以通过电脑进行控制。
本文将详细介绍qtscrcpy的使用方法。
二、安装1. 首先,确保电脑上已经安装了adb工具,可以通过在命令行输入adb version来检查。
2. 下载qtscrcpy的二进制文件,可以从GitHub上找到最新的版本。
3. 解压下载的文件到任意目录。
三、运行1. 打开命令行,进入qtscrcpy所在的目录。
2. 输入命令./qtscrcpy,即可启动qtscrcpy。
3. 如果第一次运行,会弹出一个窗口让你选择设备,选择要连接的安卓设备。
4. 等待一段时间,qtscrcpy会自动连接到设备,并将设备的屏幕内容显示在电脑上。
四、基本操作1. 屏幕显示:qtscrcpy会将安卓设备的屏幕内容实时显示在电脑上,你可以在电脑上看到和操作设备的界面。
2. 屏幕录制:你可以通过qtscrcpy将安卓设备的屏幕录制为视频文件,只需在命令行中输入./qtscrcpy --record file.mp4,即可开始录制,录制结束后,会生成一个名为file.mp4的视频文件。
3. 屏幕截图:你可以在qtscrcpy中随时进行屏幕截图,只需按下键盘上的Ctrl + S组合键,即可保存当前屏幕内容为图片文件。
4. 屏幕分辨率:你可以通过qtscrcpy调整屏幕的分辨率,只需在命令行中输入./qtscrcpy --max-size 1920x1080,即可将屏幕分辨率设置为1920x1080。
5. 屏幕旋转:你可以通过qtscrcpy将屏幕旋转到不同的方向,只需在命令行中输入./qtscrcpy --rotation 1,即可将屏幕旋转90度。
6. 屏幕镜像:你可以通过qtscrcpy将电脑上的屏幕内容镜像到安卓设备上,只需在命令行中输入./qtscrcpy --forward-touch,即可实现屏幕镜像。
基于处理器SC22410的手持终端触摸屏的设计_secret
基于处理器SC22410的手持终端触摸屏的设计_secret.txt一个人一盒烟一台电脑过一天一个人一瓶酒一盘蚕豆过一宿。
永远扛不住女人的小脾气,女人永远抵不住男人的花言巧语。
本文由kingwo2贡献doc文档可能在WAP端浏览体验不佳。
建议您优先选择TXT,或下载源文件到本机查看。
摘要随着嵌入式技术在智能手机、PDA 等手持终端设备的应用越来越广泛,触摸屏作为一种终端输入设备,具有节省空间、操作简单、反应速度快等优点,非常适用作手持终端等嵌入式系统的输入设备。
S3C2410 是一款具有 ARM920T 内核的 16/32 位微处理器。
作为新一代嵌入式平台的核心,ARM9 采用 5 级流水线,使用大量寄存器,并支持协处理器和片上调试,以指令执行速度快,寻址方式灵活简单,执行效率高为优势,在工业控制、无线通讯、消费类电子产品、成像和安全产品等各个领域得到了广泛的应用。
嵌入式 Linux 是在开放源代码 Linux 的基础上发展起来的,内核精简,内存管理功能强大,支持多任务,以设备驱动程序的方式提供统一的外设接口。
因此 Linux 是嵌入式操作系统的最佳选择。
Qt/Embedded是一个专门为嵌入式系统提供图形界面的用户系统,提供了丰富的窗口小部件,支持窗口部件的定制,而且内存消耗少。
本文介绍了基于 S3C2410 处理器平台,以嵌入式 Linux 操作系统和 Qt/Embedded为接口的LCD触摸屏操作界面的设计。
该方案可运用于高档汽车GPS 巡航系统、工程机械安全仪表和电能质量监测仪等实际工程应用中。
关键词:触摸屏;嵌入式Linux;ARM;Qtopia移植1TitleRealization of the Hand-hold Terminals’ Touch Screenbased on the S3C2410 ProcessorAbstractWith the application of embedded technology in smart phones, PDA and other hand-hold terminal equipments is increasingly extensive. As an input device of terminal equipment, the Touch screen has the advantages of space saving, simple operation, fast response, is very suitable as the input equipment of the hand-hold terminals and other embedded systems. S3C2410 is one 16/32-bit microprocessor with ARM920T core. As the core of the new generation of the embedded platform, ARM9 uses 5 levels of assembly lines and massive registers, supporting the cooperated processor and debugging online, has the advantage of carries out the instruction quickly and efficiently. It is widely applied in the industry control, the wireless communication, the expense class electronic products, the imagery and the security product and so on. The embedded Linux developed from the open source code Linux, It has simply core and the function of strongly managing the memory, support the multi-duties. It provides the general interface in the way of device drivers. Therefore the Embedded Linux was considered as one of the most superior choices in the current embedded operating systems. Qt/Embedded is the system that provides the graphical user interface special used in the embedded system. It integrates a lot of small window parts, supports the custom-made window and consumes memory fewer. This paper introduced the realization of the operation of the touch screen, which in the foundation of the Embedded Linux operation system and the S3C2410 processor, isdesigned by Qt/Embedded .This plan may utilize to the upscale automobile GPS cruise 2system, the project mechanical security meter and the electrical energy quality monitor meter and so on.Keywords: Touch Screen;Embedded Linux;ARM;Qtopia Porting3目次1 引言...... 1 2 硬件平台...... 2 2.1 ARM 体系结构...... 2 2.2 S3C2410 处理器简介...... 2 2.3 触摸屏接口电路...... 3 3 交叉编译环境的建立...... 7 3.1 Linux 交叉编译环境简介...... 7 3.2 开发环境的配置...... 7 3.3 开发工具的安装...... 8 4 基于 Qt 的图形用户界面设计...... 10 4.1 Qt 体系结构...... 10 4.2 Qt 环境的建立...... 12 4.3 Qt Designer 的使用...... 15 4.4 Qtopia 虚拟平台建立...... 16 4.5 Qtopia 的移植 (17)5 触摸屏图形操作界面的实现…… 19 5.1 Linux 设备驱动程序…… 19 5.2 触摸屏驱动程序分析…… 22 5.3 Qt/Eembedded 中的触摸屏驱动接口…… 28 5.4 Qt/Embedded 的触摸屏驱动接口的设置…… 30 5.5 驱动程序调试过程中出现的问题…… 31 结论……34 致谢...... 35 参考文献...... 36 附录 A 触摸屏驱动部分源程序 (37)41引言嵌入式系统就是以应用为中心、以计算机技术为基础,软、硬件可裁剪,对功能可靠性、成本、体积和功耗等严格要求的专用计算机系统[1]。
QT鼠标事件和滚轮事件学习
QT⿏标事件和滚轮事件学习⿏标事件和滚轮事件QMouseEvent类⽤来表⽰⼀个⿏标事件,在窗⼝部件中按下⿏标或者移动⿏标指针时,都会产⽣⿏标事件。
通过QMouseEvent类可以获取⿏标是哪个键被按下、⿏标指针(光标)的当前位置。
QWheelEvent类⽤来表⽰⿏标滚轮事件,主要⽤来获取滚轮移动的⽅向和距离。
代码widget.h#ifndef WIDGET_H#define WIDGET_H#include <QWidget>QT_BEGIN_NAMESPACEnamespace Ui { class Widget; }QT_END_NAMESPACEclass Widget : public QWidget{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();protected:void mousePressEvent(QMouseEvent *event);void mouseReleaseEvent(QMouseEvent *event);void mouseDoubleClickEvent(QMouseEvent *event);void mouseMoveEvent(QMouseEvent *event);void wheelEvent(QWheelEvent *event);private:Ui::Widget *ui;QPoint offset; // ⽤来存储⿏标指针位置与窗⼝位置的差值};#endif// WIDGET_Hwidget.cpp#include "widget.h"#include "ui_widget.h"#include <QMouseEvent>Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){QCursor cursor; // 创建光标对象cursor.setShape(Qt::OpenHandCursor); // 设置光标形状⿏标进⼊窗⼝改为⼩⼿掌形状 Qt助⼿中搜索Qt::CursorShape关键字查看常⽤的⿏标形状setCursor(cursor); // 使⽤光标// setMouseTracking(true); // 设置⿏标跟踪不按键也能获取⿏标移动事件ui->setupUi(this);}Widget::~Widget(){delete ui;}void Widget::mousePressEvent(QMouseEvent *event) // ⿏标按下事件{if (event->type() == Qt::LeftButton) { // ⿏标左键按下QCursor cursor;cursor.setShape(Qt::ClosedHandCursor); //设置光标形状为抓起来的⼩⼿offset =event->globalPos() - pos(); // 获取指针位置和窗⼝位置的差值} else if (event->type() == Qt::RightButton) { // ⿏标右键按下QCursor cursor(QPixmap(":/logo.png"));QApplication::setOverrideCursor(cursor); // 使⽤⾃定义的图⽚作为⿏标指针}}void Widget::mouseMoveEvent(QMouseEvent *event){if (event->buttons() & Qt::LeftButton) { // button函数⽆法获取哪个键被按下,buttons可以,buttons按位与Qt::LeftButton判断⿏标左键是否按下QPoint temp;temp = event->globalPos() - offset;move(temp); // 使⽤⿏标指针当前的位置减去差值,就得到了窗⼝应该移动的位置}}void Widget::mouseReleaseEvent(QMouseEvent *event) // 释放⿏标事件{Q_UNUSED(event);QApplication::restoreOverrideCursor(); // 恢复⿏标指针形状 restoreOverrideCursor要和setOverrideCursor函数配合使⽤}void Widget::mouseDoubleClickEvent(QMouseEvent *event) // ⿏标双击事件{if (event->button() == Qt::LeftButton) { // ⿏标左键按下if (windowState() != Qt::WindowFullScreen) { // 当前不是全屏setWindowState(Qt::WindowFullScreen); // 将窗⼝设置成全屏 setWindowState设置窗⼝全屏或者恢复原来⼤⼩ } else {setWindowState(Qt::WindowNoState); // 恢复原来的⼤⼩}}}void Widget::wheelEvent(QWheelEvent *event) // 滚轮事件在设计界⾯拖⼊⼀个 Text Edit{if (event->delta() > 0) { // 滚轮远离使⽤者ui->textEdit->zoomIn(); // 进⾏放⼤} else {ui->textEdit->zoomOut(); // 进⾏缩⼩}}。
3.QT屏幕分辨率适配
3.QT屏幕分辨率适配
需求:qt的窗⼝、组件、字体需要适配屏幕分辨率。
思路:qt是根据显⽰器的物理长度或者宽度于分辨率的关系来计算dpi
实现:
#if(QT_VERSION >= QT_VERSION_CHECK(5,6,0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication a(argc, argv);
const float DEFAULT_DPI = 96.0;
HDC screen = GetDC(NULL);
FLOAT dpiX = static_cast
ReleaseDC(0, screen);
float fontSize = dpiX / DEFAULT_DPI;
QFont font = a.font();
font.setPointSize(font.pointSize()*fontSize);
a.setFont(font);
注意:需要写在main()⾥