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.
我正在实现自由形式的绘图,用于使用鼠标按下绘制自由路径并使用Qpainter QPainterpath移动
Qpainter
现在我必须检测绘制的路径何时与另一条交叉或相交。我如何识别线在某个点何时相互交叉并向用户发出警告。
Qt API 没有这种能力来判断由不同元素组成的路径是否在一个点相交。你应该自己检查一下。QPainterPath::intersects路径完成后,使用函数比较路径的分段段。这些元素可以通过QPainterPath::elementAt(int index).
QPainterPath::intersects
QPainterPath::elementAt(int index)