I am attempting to display the plot values of different points on my QCustomPlot
in which I have a Line style of lsLine
. I know i could set a mouse over signal on the QCustomPlot
but that wont really help since I just need to be informed when the mouse is over my plotted line.My question is is there any way to find out if the mouse is over my scatter point. Is there a signal i could connect to that would tell me when the mouse is over a scatter point ?
相关问题
- Sorting 3 numbers without branching [closed]
- QML: Cannot read property 'xxx' of undefin
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
You can easily just connect a slot to the
mouseMove
signal thatQCustomPlot
emits. You can then useQCPAxis::pixelToCoord
to find the coordinate :when You use datetime format (including more point per second) of X axis, then pixel to coord fails. If you want to display coordinates between points, then this is the fastest way
maybe usefull (with connected signal
QCustomplot::MouseMove
)Reimplement
QCustomPlot::mouseMoveEvent
or connect toQCustomPlot::mouseMove
.Then use axes'
coordToPixel
to translate (cursor) pixel coords to plot coords and search nearest points in yourQCPDataMap
withQMap::lowerBound(cursorX)
.