Qt Charts zoom signal is missing
I am working on a signal viewer powered by Qt Charts. I manipulate dozen of curves with 65 Millions points and OpenGL is not sufficent.
So I have to downsample, I have written an algorithm that plot only ymin & ymax of a high density area thus plotting only my window pixel width.
Problem comes when I zoom, I am able to zoom through mouse and keyboard but I cannot find a correct signal where I can plug a slot for updating my downsampling.
An idea is to do it while grabbing keyboard and mouse event but it is not clean as it will lag my UI.
Any ideas ?
As I found the solution, I will respond to myself.
I have a QChart inside a QChartView. A zoom is a X axis range change, but QChart has a QAbstractAxis with no signal refering to X Axis range change.
The trick was to static_cast<QValueAxis *>(chart()->axisX()), then we have access to &QValueAxis::rangeChanged signal which is emitted for each zoomIn or zoomOut. It gives you the new visible range from which I determine a new width to compute my downsample.
Hi and welcome to devnet,
You should use qobject_cast when casting QObject based classes.
I applied your suggestion. Thanks
What it is the difference btw ? qobject_cast is the equivalent of static_cast for QObject ?
More or less. static_cast doesn't do any check. With it you basically just tell the computer what the object should be.
qobject_cast verifies that the object you are casting is of the right type or at least one subclass of the type you pass as template parameter.