@@ -23,9 +23,10 | |||
|
23 | 23 | |
|
24 | 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. | |
|
27 | First line of the code below creates new line series. Line number two sets the model as the data source for the series. | |
|
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. | |
|
26 | First line of the code below creates new line series. Line number two creates an instance of QVXYModelMapper class. | |
|
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 | To create a connection between the series and the model we set both of those objects to QVXYModelMapper. | |
|
29 | ||
|
29 | 30 | Finally the series is added to the chart. |
|
30 | 31 | |
|
31 | 32 | \snippet ../examples/modeldata/tablewidget.cpp 4 |
@@ -44,7 +45,7 | |||
|
44 | 45 | \snippet ../examples/modeldata/tablewidget.cpp 7 |
|
45 | 46 | |
|
46 | 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 | 50 | \snippet ../examples/modeldata/tablewidget.cpp 8 |
|
50 | 51 |
General Comments 0
You need to be logged in to leave comments.
Login now