Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要获取鼠标当前悬停位置的 QImage 坐标。就像在图像编辑程序中一样,我们可以看到鼠标当前悬停的像素坐标。
调用setMouseTracking(true),并覆盖mouseMoveEvent。mouseMoveEvent每当鼠标在 QImage 内移动时,都会调用您的函数。(您必须创建 QImage 的子类来执行此操作。)
setMouseTracking(true)
mouseMoveEvent