My code uses QtCharts.
this has - even in the latest docs - the method axisX()
I use this for
chart->axisX()->setRange(0, data.size());
chart->axisY()->setRange(0, max);
However with Qt 5.12 I get this message
warning: 'QtCharts::QAbstractAxis* QtCharts::QChart::axisY(QtCharts::QAbstractSeries*) const' is deprecated
How am I supposed to replace the code with something not deprecated?
Indeed, the mentioned functions are marked as deprecated in the Qt source code:
Q_DECL_DEPRECATED QAbstractAxis *axisX(QAbstractSeries *series = nullptr) const;
Q_DECL_DEPRECATED QAbstractAxis *axisY(QAbstractSeries *series = nullptr) const;
I think you have to use the following function instead:
QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical,
QAbstractSeries *series = nullptr) const;
I.e.
auto xAxis = chart->axes(Qt::Horizontal);
auto yAxis = chart->axes(Qt::Vertical);
[..]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With