Qt, Mouse skipping, not updating every pixel, mouseMoveEvent()

前端 未结 2 462
悲哀的现实
悲哀的现实 2020-12-10 19:47

I working on a simple paint program. It seemed Qt (and KDE) would be a easy way to implement it. I find Qt quite easy to work with, but now I have hit a problem.

Whe

相关标签:
2条回答
  • 2020-12-10 20:17

    Mouse events don't occur for each pixel as the mouse moves, on most operating systems. The message handlers (including KDE/linux) repeatedly show mouse movements, but pixels will often be skipped.

    You'll need to track the last pixel location, and either draw a line, or add extra points in between the last position and the current position.

    0 讨论(0)
  • 2020-12-10 20:30

    You're right - windowing systems don't deliver a mouse move event for every pixel. You need to interpolate a line between the pixels for which you get events.

    0 讨论(0)
提交回复
热议问题