[Interest] Distance from point to path.

william.crocker at analog.com william.crocker at analog.com
Tue Dec 29 15:07:00 CET 2015


On 12/29/2015 06:42 AM, Elvis Stansvik wrote:
> 2015-12-28 22:49 GMT+01:00 william.crocker at analog.com
>>
>> Given a QPoint and a QPainterPath.
>> How do I find the distance from the QPoint to the
>> closest point along the QPainterPath.
>>
> Like Konstantin said, the best approach probably depends on whether
> you know something about your paths or not (all lines? all arcs?
>

I can do it, but I should not have to.
Many programs suffer from this annoyance.

    I clearly point at object A and it selects object B.
    (Probably because it stops at the first intersecting object.)

I say this is an important feature enhancement.

    Provide a function on a QPainterPath to find the
    distance of closest approach to a QPoint.

I could then use QGraphicsScene::items() to find the
intersecting set of a bounding rectangle around the
mouse click and then nail it down with distance to
each object in that set.

> Elvis
>
>>
>> Thanks.
>>
>> Bill
>>
>> ---------
>> All of the above to find the shape closest to a mouse click.
>> Note that methods are provided to find the set of objects
>> which intersect a rectangle centered on the point, but which one
>> is really the closest?
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>



More information about the Interest mailing list