##// END OF EJS Templates
Fix vanishing labels for first and last ticks....
Fix vanishing labels for first and last ticks. Extra space must be reserved by layout for the axes that have wide labels for first or last tick. Changed the logic how axis sizeHint is interpreted to make the previously irrelevant height or width (depending on orientation) of the sizeHint to indicate how far the widest label extends past the first/last tick, and adjust the grid size accordingly in layout. Reviewed-by: Mika Salmela

File last commit:

r1385:c13c825c33e5
r2443:5b27b7b1d72a RC2_1.2.1
Show More
demos-qmlcustommodel.qdoc
29 lines | 1.5 KiB | text/plain | TextLexer
/ doc / src / demos-qmlcustommodel.qdoc
/*!
\example demos/qmlcustommodel
\title QML Custom Model
\subtitle
This example shows how to use your own QAbstractItemModel derived data model as a data source for a ChartView.
\image demos_qmlcustommodel.png
First we create a ChartView:
\snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 1
Then our data model that contains the shares of top-5 car manufacturers in Finland for the last 5 years. The model
could be constructed from various sources depending on the use case, but here we use static data for the sake of
simplicity. Check customtablemodel.cpp, declarativemodel.cpp and plugin.cpp to see how to make your own
QAbstractItemModel accessible on QML.
\snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 2
Then we create several series as children for the same ChartView. First a pie series that illustrates the shares of
the car manufacturers in Finland in 2011:
\snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 3
And one line series for each manufacturer presenting the share between 2007-2011, for example this one is for
Volkswagen. The series is not visible by default; it is made visible when the user clicks on the Volkswagen slice
on the pie series:
\snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 4
And finally a bar series that shows the share for all the other manufacturers between 2007-2011:
\snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 5
*/