Qt World Summit: Submit your Presentation

Subclassing QXYSeries in QtCharts

  • Hello all,

    I'm using the git version of QtCharts for a personal use / private project which I don't plan to redistribute in any way (doesn't make sense).

    I need to make a chart that is more or less a QLineSeries but with some modifications. So I decided to subclass QXYSeries, like QLineSeries.

    What is the best way to do this? I see QLineSeries uses private headers of QXYSeries, so it doesn't seem to be possible to do the same at user level.

    Am I right?

    So, am I obliged to put my code in the QtCharts source tree and qmake/make/install it like a QtCharts regular class?

    Another question: As I don't plan to distribute my project, can I still use QtCharts with the current license? I've seen that QtCharts will be part of the Qt distribution for the 5.7 release (IIRC).

    FYI: I'm willing to redistribute the « custom chart » part of my project, as it is not private and may benefits other users.


  • Lifetime Qt Champion


    You can make use of the private headers using QT += charts-private however if you plan to submit your custom class for inclusion you should work directly in the module.

  • Hello,

    Thanks you for the answer.


Log in to reply