Qt隐藏鼠标(嵌入式)

来源:互联网 发布:基础地理信息数据 编辑:程序博客网 时间:2024/04/27 16:55

嵌入式Qt程序一般不需要显示鼠标。

     参考http://hi.baidu.com/dreammerge/item/81c301e4dbc379a9c00d75c5

        用方法4:main()函数加入 #include <QWSServer>,实例化QApplication后,添加QWSServer::setCursorVisible(false);

     但是程序启动的时候还是会用难看的绿色小方框。

    修改Qt原码:src/gui/embedded/qwscursor_qws.cpp文件中
void QWSServerPrivate::initializeCursor()
函数
原来的:
     setCursor(QWSCursor::systemCursor(Qt::ArrowCursor)); 

    q->sendMouseEvent(QPoint(swidth/2,sheight/2), 0); 
修改为
     setCursor(QWSCursor::systemCursor(Qt::BlankCursor));    //gtremend

    q->sendMouseEvent(QPoint(swidth,sheight), 0);  //gt remend
重新编译原码

        移植到板子上上可能还会提示solidFill_setup(): Screen depth 15 not supported 之类的错误,在configure的时候不加-depths 16,18或-depths all之类的,然后编译就可以了。

0 0