答案 0 :(得分:0)
我得到了该问题的预期输出。
这是我的代码,对我来说很好。
// function for mouse press events
void 2D_Graph::mousePressEvent (QMouseEvent * e) {
if(chartView->chart()->isEnabled()) {
auto curPoint = QCursor::pos();
curPoint = chartView->mapFromGlobal(curPoint);
auto pickVal = chartView->mapToScene(curPoint);
pickVal = chartView->chart()->mapFromScene(curPoint);
pickVal = chartView->chart()->mapToValue(curPoint,chartView->chart()->series().at(0));
qDebug() << "Diagram Picked Value : " << pickVal;
}
}