njxyyl 发表于 2023-8-9 10:30:42

OKMX8MPQ无法通过QCursor::pos()获取鼠标位置

直接调用QCursor::pos()void CursorTest::getCurPos()
{
    QPoint tempP=QCursor::pos();
    qDebug()<<"CPP_QCursor x: "+QString::number(tempP.x())+" y: "+QString::number(tempP.y());
}在linux虚拟机中没有问题。但交叉编译运行在板子上是,获取值始终是0,0。请问这是问什么。和weston有关吗?

左图为linux虚拟机下运行结果,右图为板子运行结果
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAACiCAYAAAA0u5ODAAAcI0lEQVR4Ae1d+ZNb1ZXOX9R676kltdRaWt2tpbWr1ZKe3qKl24EhHig7GE+chRQUE0JmIAmBMC7gh1AFISEJwwBlSKWBkAGb2IPxirEb8JJxBQiVjaJIzQ/f1H2L1qe11S27fX5QXT297b5zznfOuU/3u+dLUzYO9CEZkA1szga+RALcnABJfiQ/ZgMEJIrIlJGMwQYsgMRjmuNhs3HgOPadPA5FnZ1pA832zfM8hE0AqgNIwVARX1RSqHI8vprbhc+Wg5g2b8A5sBbN4US5io+qFZwvJPDPDh5TNh7FuIrPqirOyDLOqSrOFhLYre3jYPdn8MlaBedkGWcVFRvSCn7gndbA2s9I530xrCsV/KFSwYVCErc52f0MxXbtz85UfP25zecfsOWcIfy2tgu/XWjInHPM4fF8CUeLIt4uFfFE0AXevB7vwf54Bq8pq/g0O9fQv7l/W1se874oniup+FBVsKHK+PWSD36zD/wM/iVdxClZwmm5hBcjXnjNfTY7CqFlHC6JOCxKOJaLQhJM2+CxJ7eGz3JBTHN+PFXdhTdCDfkMK+sOIHkW8vhcTaLE8bglW8MnmQDsWsd4FGIyrhSiUOw6eKKBBdxcB5KCUzE3OO1YAfmYhKvZObhsOpCuFsMIGg/o9aVwXk1C6RPtOEcIr1dEfN9tx5RNQCqUxx9KS0hr5/Xqjyksaqc4N/6tKOG/xTJerQOJx00ZFesLDs2Z2exBPK9k8RXekBfnRMHnx20JCX+aOJA4BGbnsMspaA7UZp/Dr8oy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NC27UZeWa8nT9DxH5GnI0/RcdLWpTJcKSbcKGHmaqlaEl5y3bLK7JSJutyqiQdMGTUPxD6z42zU7TUPT0DQWNUDTWAxYu9WJn9ti53BNdEHTNAkOhb59hN7JXFowjfO4hk4GgttyqkGcpzth05CncaqorI+LPI31mNUXVWHTkKexF+j6oPf3MXkau/EXNg15GvI05GlKhVPYNORpyNOQp7FoGrOWRp6GPI1RG+RpWi3JkqchT2PQCHkaQ0CMVYU8DXmamibI04j/vII8DXkavbiSpxE3Tctu1KXlWvI0Pc8ReRryND0XXW0q06VC0q0CRp6mqhXhJectm+xuiYjbrYpo0LRB01D8Ayv+ds1O09A0NI1FDdA0FgPWbnXi57bYOVwTXezYu+9WrGu3vfv02w033sTK0yRgFP/2EX+7udwxJEnQb2WhmJvGeVxDuwfNz20l4TtPd8KdhjzNVhJa87GSp2ken1ZFVfichjyNvUC3SkTvXidPYzfWwqYhT0OehjxNqXAKm4Y8DXka8jRl0zxw6EFEYwlEl+NtrZ6RpyFPY5zukKdptfxKnoY8jUEj5GkMATFWFfI05GlqmiBPI/4lJ3ka8jR6cSVPI26alt2oS8u15Gl6niPyNORpei662lSmS4WkWwWMPE1VK8JLzls22d0SEbdbFdGgaYOmofgHVvztml34t2ft7oCf22LTMBaRlkXk/6+NXmhnu3TuAAAAAElFTkSuQmCC

w_y_y 发表于 2023-8-10 11:02:50

我们对qt也不是很了解,您把源码发过来,我们帮您看一下?

njxyyl 发表于 2023-8-14 09:08:59

w_y_y 发表于 2023-8-10 11:02
我们对qt也不是很了解,您把源码发过来,我们帮您看一下?

附件为源码,
源码只写了一个CPP的类,调用了QCursor::pos();方法获取鼠标坐标

cursortest.cpp
#include "cursortest.h"
#include <QCursor>
#include <QPoint>
#include <QtDebug>

CursorTest::CursorTest(QObject *parent) : QObject(parent)
{

}

void CursorTest::getCurPos()
{
    QPoint tempP=QCursor::pos();
    qDebug()<<"CPP_QCursor x: "+QString::number(tempP.x())+" y: "+QString::number(tempP.y());
}
main.qml中调用了getCurPos方法
import QtQuick 2.11
import QtQuick.Window 2.11
import MyTest 1.0

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    //flags: Qt.FramelessWindowHint

    MouseArea{
      id:mainArea
      anchors.fill: parent
      focus:true
      onPressed : {
            print("QML MouseArea_x:",mouse.x,",y:",mouse.y);
            myTest.getCurPos();
      }

    }
    CursorTest{
      id:myTest
    }
}点击屏幕,控制台会打出日志。一个是通过MouseArea获取的鼠标位置,结果正常。一个是通过QCursor::pos();打出的鼠标屏幕的位置,则全为0.日志如下:
qml: QML MouseArea_x: 374.6015625 ,y: 258.75
"CPP_QCursor x: 0 y: 0"
qml: QML MouseArea_x: 365 ,y: 243.125
"CPP_QCursor x: 0 y: 0"
qml: QML MouseArea_x: 373 ,y: 238.75
"CPP_QCursor x: 0 y: 0"


页: [1]
查看完整版本: OKMX8MPQ无法通过QCursor::pos()获取鼠标位置