C++ 使用鼠标区域移动后,如何获取qml元素的x、y和值?
使用Qt5官方版本-- 我需要保存图像元素的x,y属性。这个C++ 使用鼠标区域移动后,如何获取qml元素的x、y和值?,c++,qt,qml,qt5,C++,Qt,Qml,Qt5,使用Qt5官方版本-- 我需要保存图像元素的x,y属性。这个 QObject* pic = rootitem1->findChild<QObject*>("image_objectName"); int x = pic->property("x").toInt(); QObject*pic=rootitem1->findChild(“image_objectName”); intx=pic->property(“x”).toInt(); 提供属性最初设置的值,但我需要
QObject* pic = rootitem1->findChild<QObject*>("image_objectName");
int x = pic->property("x").toInt();
QObject*pic=rootitem1->findChild(“image_objectName”);
intx=pic->property(“x”).toInt();
提供属性最初设置的值,但我需要的是鼠标移动图像后的当前值。我可能遗漏了一些简单的东西,但我找不到其他任何东西。非常感谢您的帮助,谢谢。解决了这个问题。对于任何其他正在查看的用户,请使用mapToScene()。