Qt4.7.0 使用电容屏
来源:互联网 发布:淘宝网2016官方电脑版 编辑:程序博客网 时间:2024/06/15 18:41
# cd build
# ../4.7.0/configure -opensource -embedded arm -xplatform qws/linux-armv6-g++ -no-webkit -qt-libtiff -qt-libmng -no-mouse-tslib -no-mouse-pc -no-mouse-linuxtp -no-mouse-qvfb -no-mouse-qnx -no-neon -qt-gfx-linuxfb -qt-gfx-transformed -nomake examples -nomake demos -qt-libjpeg -qt-libpng -qt-mouse-linuxinput -prefix /opt/Qt4.7 -confirm-license
1.一定要使能 -qt-mouse-linuxinput,否则无法使用电容屏,同时 -no-mouse-tslib,-no-mouse-linuxtp,-no-mouse-pc,-no-mouse-qvfb,-no-mouse-qnx。
2.如果要使Qt程序可以旋转屏幕,那么还要使能 -qt-gfx-transformed。
启动时环境变量设置:
export QWS_MOUSE_PROTO="LinuxInput:/dev/input/event0"# 这个环境变量的得出是通过看源代码得出的,具体路径我忘记了
export HOME=/root
export QTDIR=/opt/Qt4.7
export QT_QWS_FONTDIR=$QTDIR/lib/fonts/
export QT_PLUGIN_PATH=$QTDIR/plugins
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
会有个"unkown mouse event type xxxx"的提示,解决方法:
由于驱动代码里面有一项:ABS_PRESSURE,这是android特有的,QtMouse不支持,因此修改qmouselinuxinput_qws.cpp文件,Line 163:
bool unknown = false;
if (data->type == EV_ABS) {
if (data->code == ABS_X) {
m_x = data->value;
} else if (data->code == ABS_Y){
m_y = data->value;
} else {
unknown= false;//modified by antony,because we have a data->type=ABS_PRESSURE
}
问题解决!PS1:
提示:Could not read calibration: "/etc/pointercal"
还需要在/etc目录下面新建一个pointercal文件才能正常触摸, pointercal内容如下:
0 65535 16 -65535 0 31457276 65536 800 480
这些数据得来比较曲折,方法就是利用tslib,然后认为输入一些ts_calibrate工具期望的坐标数据,最后生成的。
其实还有更好的方法:
int perform_calibration(calibration *cal)里面有以下代码:
// This code was here originally to just insert default values
for(j=0;j<7;j++) {
c->a[j]=0;
}
c->a[1] = c->a[5] = c->a[6] = 1;
return 1;
for(j=0;j<7;j++) {
c->a[j]=0;
}
c->a[1] = c->a[5] = c->a[6] = 1;
return 1;
可见,默认的方程的解应该是,0 1 0 0 0 1 1,
然后,main()函数里面:
len = sprintf(cal_buffer,"%d %d %d %d %d %d %d %d %d",
cal.a[1], cal.a[2], cal.a[0],
cal.a[4], cal.a[5], cal.a[3], cal.a[6],
xres, yres);
cal.a[1], cal.a[2], cal.a[0],
cal.a[4], cal.a[5], cal.a[3], cal.a[6],
xres, yres);
可见,pointercal文件里面的值就是方程的理想解,排列应该是:1 0 0 0 1 0 1
于是理想的pointercal文件如下:
1 0 0 0 1 0 1 800 480
如果你还想反向X轴,则:
1 0 0 0 -1 480 800 480
因为,在qt4.7.0/src/gui/embeded/qmouse_qws.cpp文件中,有如下转换函数:
QPoint QWSCalibratedMouseHandler::transform(const QPoint &position)
{
QPoint tp;
tp.setX((a * position.x() + b * position.y() + c) / s);
tp.setY((d * position.x() + e * position.y() + f) / s);
return tp;
}
如果你还想反向X轴,则:
1 0 0 0 -1 480 800 480
因为,在qt4.7.0/src/gui/embeded/qmouse_qws.cpp文件中,有如下转换函数:
QPoint QWSCalibratedMouseHandler::transform(const QPoint &position)
{
QPoint tp;
tp.setX((a * position.x() + b * position.y() + c) / s);
tp.setY((d * position.x() + e * position.y() + f) / s);
return tp;
}
PS2:
如果你用android内核修改,那么记得不要使用多点触摸来上报输入事件,因为QT无法识别,官方说可以,我不知道怎么弄,哪个晓得的告诉我一声啊!理由,看: qmouse linuxinput _qws.cpp,里面读取的坐标数据都是ABS_X, ABS_Y没有带MT的。
转自:http://www.voidcn.com/article/p-wmpvekox-mo.html
阅读全文
0 0
- Qt4.7.0 使用电容屏
- Qt4.7.0 使用电容屏
- 使用DirecetFB支持Qt4.7.0
- 使用DirecetFB支持Qt4.7.0
- 电容屏单点的tslib的使用
- QT4 使用
- 电阻电容的使用
- Qt4 QTableWidget 使用教程
- Qt4 QCheckBox 使用教程
- 成功使用qt4!!!呵呵
- Qt4之DockWidget使用
- QT4 Designer的使用
- QT4.8 使用plot3D
- Qt4 使用QJson库
- qt4中dbus使用
- 经典的电容使用知识
- 使用法国SOLEN电容有感
- 什么是电容屏
- form配合iframe实现文件异步上传
- ngnix安装配置以及代理配置
- 摄像机标定学习笔记(11)opencv姿态解算7 四大坐标系,摄像机线性模型, 畸变模型
- 经典论文翻译导读之《Google File System》
- 求两个字符串的最长公共子序列的长度(动态规划)
- Qt4.7.0 使用电容屏
- Java 里如何实现线程间通信
- ImageLoader 图片加载框架
- linux 打开文件数 too many open files 解决方法
- html笔记
- 支持双向范围选择和普通模式的SeekBar
- SQLSERVER排查CPU占用高的情况
- 文件处理命令less
- C++设计模式感想