QML Bar Chart with live-updating data from C++
-
wrote on 2 Jul 2015, 21:49 last edited by
I want to visualize data coming from an Arduino in a Bar Chart and am scratching my head on how to get any data from C++ into the bar chart.
Is there an easy example somewhere? All I could find were outdated or overly complicated.
-
I want to visualize data coming from an Arduino in a Bar Chart and am scratching my head on how to get any data from C++ into the bar chart.
Is there an easy example somewhere? All I could find were outdated or overly complicated.
Hi @Hedge,
You have following ways to do it:- Defining QML Types from C++
In short create a QObject derived class and register it using qmlRegisterType so that it is available in QML. - Exposing Attributes of C++ Types to QML
Create a QObject derived class , add some public slots orQ_INVOKABLE
functions and make these available by setting that class as a contextProperty.
In both the cases it will be good idea to provide some properties defined as
Q_PROPERTY
with their respective signals so that QML gets notified on changes in the values of these properties from C++. - Defining QML Types from C++
2/2