@@ -23,9 +23,10 | |||||
23 |
|
23 | |||
24 | \snippet ../examples/modeldata/tablewidget.cpp 3 |
|
24 | \snippet ../examples/modeldata/tablewidget.cpp 3 | |
25 |
|
25 | |||
26 | Then let's create two QLineSeries and tell them to use the data from the model. |
|
26 | First line of the code below creates new line series. Line number two creates an instance of QVXYModelMapper class. | |
27 | First line of the code below creates new line series. Line number two sets the model as the data source for the series. |
|
27 | Next two lines specifie that x coordinates are taken from the model's column(Qt::Vertical) with index 0 and the y coordinates are taken from the model's column with index 1. | |
28 | Third line specifies that x coordinates are taken from the model's column(Qt::Vertical) with index 0 and the y coordinates are taken from the model's column with index 1. |
|
28 | To create a connection between the series and the model we set both of those objects to QVXYModelMapper. | |
|
29 | ||||
29 | Finally the series is added to the chart. |
|
30 | Finally the series is added to the chart. | |
30 |
|
31 | |||
31 | \snippet ../examples/modeldata/tablewidget.cpp 4 |
|
32 | \snippet ../examples/modeldata/tablewidget.cpp 4 | |
@@ -44,7 +45,7 | |||||
44 | \snippet ../examples/modeldata/tablewidget.cpp 7 |
|
45 | \snippet ../examples/modeldata/tablewidget.cpp 7 | |
45 |
|
46 | |||
46 | To avoid setting up the QGraphicsScene we use QChartView class that does it for us. QChart object pointer is used as a parameter of the QChartView constructor. |
|
47 | To avoid setting up the QGraphicsScene we use QChartView class that does it for us. QChart object pointer is used as a parameter of the QChartView constructor. | |
47 | To make the render look nicer Antialiasing is turned on and the minimum size of the chart is set. |
|
48 | To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set. | |
48 |
|
49 | |||
49 | \snippet ../examples/modeldata/tablewidget.cpp 8 |
|
50 | \snippet ../examples/modeldata/tablewidget.cpp 8 | |
50 |
|
51 |
@@ -94,7 +94,7 TableWidget::TableWidget(QWidget *parent) | |||||
94 | //! [8] |
|
94 | //! [8] | |
95 | QChartView *chartView = new QChartView(chart); |
|
95 | QChartView *chartView = new QChartView(chart); | |
96 | chartView->setRenderHint(QPainter::Antialiasing); |
|
96 | chartView->setRenderHint(QPainter::Antialiasing); | |
97 | chartView->setMinimumSize(640, 480); |
|
97 | // chartView->setMinimumSize(640, 480); | |
98 | //! [8] |
|
98 | //! [8] | |
99 |
|
99 | |||
100 | //! [9] |
|
100 | //! [9] |
General Comments 0
You need to be logged in to leave comments.
Login now