Qt graph vs Qt chart
-
@flyyhigh said in Qt graph vs Qt chart:
But I wonder to know when I should use chart and when I should use graph
As per documentation, for new projects it's recommended to start with Qt Graphs.
But there's nothing wrong with using Qt Charts.Probably you have to keep an eye on changes.
what is the differences between these two?
There should be no difference at some point.
Qt Graphs will fully replace and even improve the Qt Chart module.One major difference is that Charts are rendered using Qt's Graphics View Framework, while Graph elements for both C++ and QML, are rendered using Qt Quick Shapes (QML-based).
Currently there are some parts and features missing in Qt Graphs, as both modules are in development/maintenance phase:
-
If you can (i.e. no feature is missing) use Qt Graphs as Qt Charts will be phased out eventually. At some you'd have to switch.
Also keep in mind that these modules are not available under the LGPL, but only GPL or commercial license. If you want a more permissive license you can use Qwt (https://qwt.sourceforge.io/) instead.
-
@Pl45m4 said in Qt graph vs Qt chart:
One major difference is that Charts are rendered using Qt's Graphics View Framework, while Graph elements for both C++ and QML, are rendered using Qt Quick Shapes (QML-based).
Just so I understand. I write Qt widgets applications, which (so far as I know) use no QML elements and so do not link with anything QML (right?).
Occasionally I include some Qt Charts. If I replace with Qt Graphs in future does that mean my widgets application will now use/require/link with QML elements/code?
-
@JonB said in Qt graph vs Qt chart:
If I replace with Qt Graphs in future does that mean my widgets application will now use/require/link with QML elements/code?
This needs some further investigation. A quick glance tells me that when you add the
graphs
module it will also add Qt Quick. However, the overview of the modules (https://doc.qt.io/qt-6/qtmodules.html) tells me that QML is a separate module from Quick. So, maybe the truth is in the middle: your widgets application uses/requires/links Quick, but maybe not QML (I just don't know). -
@SimonSchroeder
Thanks. To me "Qt Quick" is sort of the same as "QML", I have never (deliberately) used either. At present when I write pure widgets applications I presume I use neither "Quick" nor "QML", and don't need them installed.... -
@JonB said in Qt graph vs Qt chart:
To me "Qt Quick" is sort of the same as "QML", I have never (deliberately) used either
QML <---> Qt Quick behaves the same as
C++ <---> Qt Widgets.QML is the "programming language" whereas Qt Quick is the actual framework.
As far as I know there are also 3rd party extensions and libraries other than Qt's Qt Quick written in/with QML
I think Qt Graphs will use Qt Quick Items "under the hood". So you are still dealing with a Qt Widget structure and regular C++ classes, but while being rendered on your graph, it will make use of QML/Qt Quick internally
-
@JonB said in Qt graph vs Qt chart:
So that will need installing :(
There's no evidence in the documentation that you need to install something else other than the Qt Graphs module?!
Maybe the required Qt Quick components are included, I don't know?!It's just this?!
We will see when they are done with refactoring both modules.
-
@JonB said in Qt graph vs Qt chart:
Thanks. To me "Qt Quick" is sort of the same as "QML", I have never (deliberately) used either. At present when I write pure widgets applications I presume I use neither "Quick" nor "QML", and don't need them installed....
Same here! (Never have used them, don't want them.)