time
15th November 2016, 11:00
Hello everyone :)
I want to start creating charts in Qt 5 with C++ (pie chart, bar graph etc.). I have problems with setting thinks up.
I visited the website: http://doc.qt.io/qt-5/qtcharts-index.html
They wrote:
1. To import Qt Charts QML types, add the following import statement to your .qml file :
import QtCharts 2.0
So, where is that .qml file? Where I should write it? I need to make it new?
2. If you intend to use Qt Charts C++ classes in your application, use the following include and using directives:
#include <QtCharts>
using namespace QtCharts;
That part should go to header (.h) ?
3. To link against the Qt Charts module, add this line to your qmake project file:
QT += charts
If I understand that good, this should go to .pro file?
Here is example of PieChart: http://doc.qt.io/qt-5/qtcharts-piechart-example.html
There are 2 files: piechart/main.cpp and piechart/piechart.pro
Can you write me very precisely where and how add this statements from the beginning of my post (1,2 and 3).
I want to rewrite this PieChart example to my project to learn how it's works. When I created the project, a have the following files:
- mainwindow.cpp
- mainwindow.h
- mainwindow.ui
- PieChartTest.pro
- PieChartTest.pro.user
Should I create something more?
Thank you for help!
I want to start creating charts in Qt 5 with C++ (pie chart, bar graph etc.). I have problems with setting thinks up.
I visited the website: http://doc.qt.io/qt-5/qtcharts-index.html
They wrote:
1. To import Qt Charts QML types, add the following import statement to your .qml file :
import QtCharts 2.0
So, where is that .qml file? Where I should write it? I need to make it new?
2. If you intend to use Qt Charts C++ classes in your application, use the following include and using directives:
#include <QtCharts>
using namespace QtCharts;
That part should go to header (.h) ?
3. To link against the Qt Charts module, add this line to your qmake project file:
QT += charts
If I understand that good, this should go to .pro file?
Here is example of PieChart: http://doc.qt.io/qt-5/qtcharts-piechart-example.html
There are 2 files: piechart/main.cpp and piechart/piechart.pro
Can you write me very precisely where and how add this statements from the beginning of my post (1,2 and 3).
I want to rewrite this PieChart example to my project to learn how it's works. When I created the project, a have the following files:
- mainwindow.cpp
- mainwindow.h
- mainwindow.ui
- PieChartTest.pro
- PieChartTest.pro.user
Should I create something more?
Thank you for help!