将画布坐标转换为外部微件的坐标
Convert canvas coordinates to coordinates of the external widget
我正在构建一个绘图,需要根据位于画布中的点的 Y 轴值链接位于父小部件中的标签 (QwtPlotCanvas(。
我尝试了很多方法,只有一种方法显示了一些或多或少合理的数字:plot->transform((,然后在父小部件中显示mapTo((。
剧情.cpp
QPoint(plot_->transform(QwtPlot::xBottom, pointsToMap.x()), plot_->transform(QwtPlot::yLeft, pointsToMap.y()));
主小部件.cpp
auto points = graph->getPlot()->canvas()->mapTo(this, graph->getPointsToMap());
我得到一个与画布顶部相对应的坐标。
我希望坐标在主小部件中的 Y 偏移量与画布中的坐标相同。
好的,我不得不使用QwtPlot
canvasMap
的方法。
相关文章:
- QGraphicsPolygonItem在拖动时未更新QPolygonF坐标
- 在函数内部的声明中初始化数组,并在外部使用它
- 在C++中使用GDAL可以将图像的像素坐标转换为lat,long吗
- UE4-如何在给定4个屏幕坐标的情况下缩放纹理或材质
- 使外部项目可用于find_package CMake
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- C++:来自外部文件的Trivia
- 从函数角度看ID到文件路径的内部与外部映射
- C++:将外部库链接到dll库
- spdlog标头仅与外部fmt一起使用.spdlog错误:'内部':不是'fmt'
- 节俭并发:未解决的外部问题
- 如何在c++中从git建立外部库
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何使用对C函数和类对象的外部调用来处理C++头文件
- 具有外部"c"和程序集的未定义函数
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 将外部文件中的坐标矩阵输入到 2 个数组中
- 将画布坐标转换为外部微件的坐标
- 如果用像素来给出两条线(外部和内部)之间的边缘(外部和内部)之间的边缘,则如何计算(x,y)坐标