Qwt - 如何使用 QwtPlotPicker 获取选择点索引
我使用 QwtPlot 绘制复杂数据,因此,我重新实现 QwtSeriesData 将数据转换为 QPointF。 “sample(int)”将 MyObject 转换为 QPointf。我的 QwtSeriesData 数据管理
myVector=vector<MyObject>;
现在,我需要选择绘制到我的图中的点。我尝试使用 QwtPlotPicker 但它只返回 QPointF。
如何获取所选点的索引“idx”以获得myObject=myVector[idx]
?
I plot complex data using QwtPlot, so, I reimplement QwtSeriesData for converting my data into QPointF. The "sample(int)" converts MyObject to QPointf. My QwtSeriesData data manages a
myVector=vector<MyObject>;
Now, I need to select point drawn into my plot. I try to use QwtPlotPicker but it only returns a QPointF.
How to get the index "idx" of the selected point in order to get myObject=myVector[idx]
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用曲线中的closestPoint()方法。
它将返回曲线中最近点的 id!
希望这对您有帮助。
Use the closestPoint() method in the curve.
It will return the id of the closest point in the curve!
Hope this helps you.