qt 4.8 使用多屏显示时 指针残留

export QWS_DISPLAY="Multi:VNC:LinuxFb:/dev/fb0:0 LinuxFB:/dev/fb1:1offset:800,0"

我使用 多屏显示时 鼠标移除范围 会造成鼠标指针产生多个,虽然能正常使用 屏幕鼠标越来越多

研究发现是因为 Multi 这个参数造成的,我要使用多屏还必须使用,查询资料国外用户也遇到过

qt官方也把这段代码注释了 xxx: this is a  mess! 只是没有解决

按照下面这个改动也是可以,只是鼠标靠近边缘时会跳

void QMultiScreenCursor::move(int x, int y)
{
// Get subscreen indexes
const int oldIndex = qt_screen->subScreenIndexAt(pos);
const int newIndex = qt_screen->subScreenIndexAt(QPoint(x, y));
QScreenCursor *oldCursor, *newCursor;
const QScreen *oldScreen, *newScreen;
// Old screen operations
if (oldIndex != -1)
{
    // Get the old screen from the subscreens
    oldScreen = qt_screen->subScreens().at(oldIndex);

    // Get the old screen cursor
    oldCursor = cursors.at(oldIndex);

    // Set the current cursor
    if (!currentCursor)
        setCurrentCursor(oldCursor);

    // is new position valid ?
    if (oldScreen->region().contains(QPoint(x, y)))
    {
        // Update the mouse cursor position
        QScreenCursor::move(x, y);

        // Move the old cursor
        oldCursor->move(x, y);
        return;
    }//if
}//if
else
{
    oldCursor = currentCursor;
}//else

// New screen operations
if (newIndex != -1)
{
    // Get the new screen from the subscreens
    newScreen = qt_screen->subScreens().at(newIndex);

    // Get the new screen cursor
    newCursor = cursors.at(newIndex);

    // Set the new cursor
    newCursor->set(cursor, hotspot.x(), hotspot.y());

    // Make sure the old cursor is invisible
    if (oldCursor) 
    {
        if (oldCursor->isVisible())
            newCursor->show();
        oldCursor->hide();
    }//if

    // is new position valid ?
    if (newScreen->region().contains(QPoint(x, y)))
    {
        // Update the mouse cursor position
        QScreenCursor::move(x, y);

        // Move the new cursor
        newCursor->move(x, y);
    }//if

    // Set the current cursor
    setCurrentCursor(newCursor);
}//if
经研究发现 加入宏定义 隐藏 多屏时的鼠标 也能解决

#define QT_NO_QWS_CURSOR
这样编译qt的时候 就不会 编译 这段代码 替换 原有的 qtgui.so 文件


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值