[Interest] Mapping floating point screen coordinates to QGraphicsScene

Patrick Stinson patrickkidd at gmail.com
Sun Mar 19 06:50:51 CET 2017


It looks like making this change tightened up drawing with the apple pencil. I suppose I will incorporate this in my pull request if I can ever get around to understanding how to submit one.


> On Mar 18, 2017, at 9:46 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
> 
> That’s correct, the floating point values are either 0 or .5.
> 
> I am digging into this because a) it’s offered so why not use it, and b) because I am seeing a little jitter in my pencil drawing and trying to eliminate all causes for error.
> 
>> On Mar 18, 2017, at 8:56 PM, Ch'Gans <chgans at gna.org> wrote:
>> 
>> On 19 March 2017 at 15:59, Patrick Stinson <patrickkidd at gmail.com> wrote:
>>> UITouch coordinates are floating point on iOS, for example for the Apple Pencil. Is there a way to map this? Seems like this would be easy to implement based on the QPoint version…
>>> 
>> 
>> In which coordinate system are the UITouch points expressed in? Seems
>> odd to use floating point for a pixel based CS, unless half pixels
>> exist (high res display?)
>> 
>> Chris
>> 
>>> // pks: apple pencil
>>> QPointF QGraphicsView::mapToScene(const QPointF &point) const
>>> {
>>>   Q_D(const QGraphicsView);
>>>   QPointF p = point;
>>>   p.rx() += d->horizontalScroll();
>>>   p.ry() += d->verticalScroll();
>>>   return d->identityMatrix ? p : d->matrix.inverted().map(p);
>>> }
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
> 




More information about the Interest mailing list