QT/WebKit::DirectFB模式遥控器支持
2011-06-01 00:05
459 查看
前面已经有了在framebuffer下的遥控器支持,现在用相同的办法移植到directfb模式
/*dfbRemotecontrol.h
*******DfbRemoteControl类
*/
#include <QObject>
class QTimer;
class DfbRemoteControl : public QObject
{
Q_OBJECT
public:
DfbRemoteControl();
signals:
void DfbRemoteToKeyboardSignal(unsigned long keyCode);
private slots:
void onTimer();
private:
QTimer *readTimer;
};
#endif
/*dfbRemotecontrol.cpp*/
#include <QTimer>
#include "dfbRemotecontrol.h"
DfbRemoteControl::DfbRemoteControl()
{
readTimer = new QTimer(this);
connect(readTimer, SIGNAL(timeout()), this, SLOT(onTimer()));
readTimer->start(30);
}
void DfbRemoteControl::onTimer()
{
int ret;
unsigned long keyCode;
ret = getKeycode();
if (ret == 0)/*ok*/
{
qDebug("emit keyCode=%X/n", keyCode);
emit DfbRemoteToKeyboardSignal(keyCode);
}
else
{
}
readTimer->start(10);
}
将这两个文件加入放到src/plugins/gfxdrivers/directfb目录下,并在src/gui/embedded/directfb.pri中加入:
HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/dfbRemotecontrol.h
SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/dfbRemotecontrol.cpp
在qdirectfbkeyboard.cpp中的class QDirectFBKeyboardHandlerPrivate中加入public方法int dfbRemote2key(char *keycode, unsigned long remoteCode);加入slot方法void dfbRecvRemoteEvent(unsigned long remoteCode);
连接信号和槽:
if(dfbRemotecontrol == NULL)
{
dfbRemotecontrol = new DfbRemoteControl();
}
connect(dfbRemotecontrol, SIGNAL(DfbRemoteToKeyboardSignal(unsigned long)),this,SLOT(dfbRecvRemoteEvent(unsigned long)));
方法int QDirectFBKeyboardHandlerPrivate::dfbRemote2key(char *keycode, unsigned long remoteCode)取得遥控器所对应的键盘的值
而真正进行键值处理的函数为handler->processKeycode。
/*dfbRemotecontrol.h
*******DfbRemoteControl类
*/
#include <QObject>
class QTimer;
class DfbRemoteControl : public QObject
{
Q_OBJECT
public:
DfbRemoteControl();
signals:
void DfbRemoteToKeyboardSignal(unsigned long keyCode);
private slots:
void onTimer();
private:
QTimer *readTimer;
};
#endif
/*dfbRemotecontrol.cpp*/
#include <QTimer>
#include "dfbRemotecontrol.h"
DfbRemoteControl::DfbRemoteControl()
{
readTimer = new QTimer(this);
connect(readTimer, SIGNAL(timeout()), this, SLOT(onTimer()));
readTimer->start(30);
}
void DfbRemoteControl::onTimer()
{
int ret;
unsigned long keyCode;
ret = getKeycode();
if (ret == 0)/*ok*/
{
qDebug("emit keyCode=%X/n", keyCode);
emit DfbRemoteToKeyboardSignal(keyCode);
}
else
{
}
readTimer->start(10);
}
将这两个文件加入放到src/plugins/gfxdrivers/directfb目录下,并在src/gui/embedded/directfb.pri中加入:
HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/dfbRemotecontrol.h
SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/dfbRemotecontrol.cpp
在qdirectfbkeyboard.cpp中的class QDirectFBKeyboardHandlerPrivate中加入public方法int dfbRemote2key(char *keycode, unsigned long remoteCode);加入slot方法void dfbRecvRemoteEvent(unsigned long remoteCode);
连接信号和槽:
if(dfbRemotecontrol == NULL)
{
dfbRemotecontrol = new DfbRemoteControl();
}
connect(dfbRemotecontrol, SIGNAL(DfbRemoteToKeyboardSignal(unsigned long)),this,SLOT(dfbRecvRemoteEvent(unsigned long)));
方法int QDirectFBKeyboardHandlerPrivate::dfbRemote2key(char *keycode, unsigned long remoteCode)取得遥控器所对应的键盘的值
而真正进行键值处理的函数为handler->processKeycode。
相关文章推荐
- qt webkit 中文支持
- 让 QtWebkit 支持跨域CROS - nowboy的CSDN博客 - 博客频道 - CSDN.NET
- 让 QtWebkit 支持跨域CROS - nowboy的CSDN博客 - 博客频道 - CSDN.NET
- Qt-4.8 WebKit + QtWebKit-2.3.x上CSS3 Web Fonts支持的一些记录
- QtWebkit2.2.0 HTML5.0支持情况
- qt tableview 选择模式详解 支持不连续选中
- QT 5.7 mingw 不支持webkit
- Qt设计模式-单例模式
- 详解 Qt 中实现单例模式
- QtWebKit插件编程
- Debug显示不支持opengl4,是双显卡未设置独立显卡模式
- chrome 不支持12px以下字体为题的解决(使用-webkit-transform:scale(0.75))
- 谈谈QtWebkit 键盘鼠标事件过滤
- Qt支持Xp的最后一个版本
- 为Qt添加SSL支持
- 关于Qt Webkit模块详细介绍
- 配置nginx支持path_info模式
- win7下,QT 及 QGLViewer 环境配置总结 | 版本匹配问题 | 解决debug模式下无法打开窗口
- QT5应用程序发布(支持WinXP)
- thinkPHP3.2.2中支持的URL的四种模式