It seems I can't find a way to include <QtCharts/QLineSeries>
in my header so Qt knows about the QLineSeries class.
Qt += charts
to my .pro file.#include <QtCharts/QLineSeries>
to MainWindow.h
Release
, run QMake by right-clicking the project and selecting it and Run it.I get the message:
...\PlottingCharts\mainwindow.h:14: error: 'QLineSeries' does not name a type
QLineSeries *series;
^
So clearly Qt doesn't know anything about QLineSeries.
For reference, the linechart
and openglseries
examples work correctly.
Any one knows what I'm missing?
As I wrote the question I found the answer.
I was missing using namespace QtCharts;
in the header file.
Got the reference from: http://doc.qt.io/qt-5/qtcharts-index.html
If you want to avoid specifying the namespace, you can also declare your variable as:
QtCharts::QLineSeries *series;
With this solution you always have to prepend QtCharts::
, but you also know your scope and the origin of your calls.
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