summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-27 13:10:44 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-27 13:13:58 +0200
commitb368e57e59351736f9ad06834a743a7c1b49d368 (patch)
tree3b7d42569905d8cde0ca7571cd664428354a50dd
parenteb3d0514ca886db33776522ea00f27b69bc86ad1 (diff)
parent05d06fbc61f07e400b519a9b020c2473398627c1 (diff)
Merge branch 'develop'v1.0.0-beta1
-rw-r--r--README11
-rw-r--r--examples/audiolevels/audiolevels.cpp33
-rw-r--r--examples/audiolevels/audiolevels.h4
-rw-r--r--examples/audiolevels/audiolevelsiodevice.cpp4
-rw-r--r--examples/audiolevels/audiolevelsiodevice.h4
-rw-r--r--examples/audiolevels/doc/images/audiolevels-example.pngbin70631 -> 120978 bytes
-rw-r--r--examples/audiolevels/doc/src/audiolevels.qdoc2
-rw-r--r--examples/audiolevels/main.cpp2
-rw-r--r--examples/bars/doc/images/bars-example.pngbin149324 -> 135242 bytes
-rw-r--r--examples/bars/doc/src/bars.qdoc8
-rw-r--r--examples/bars/graphmodifier.cpp108
-rw-r--r--examples/bars/graphmodifier.h17
-rw-r--r--examples/bars/main.cpp38
-rw-r--r--examples/custominput/custominputhandler.cpp2
-rw-r--r--examples/custominput/custominputhandler.h2
-rw-r--r--examples/custominput/doc/images/custominput-example.pngbin108178 -> 62422 bytes
-rw-r--r--examples/custominput/doc/src/custominput.qdoc2
-rw-r--r--examples/custominput/main.cpp2
-rw-r--r--examples/custominput/scatterdatamodifier.cpp20
-rw-r--r--examples/custominput/scatterdatamodifier.h4
-rw-r--r--examples/customproxy/doc/images/customproxy-example.pngbin121510 -> 125698 bytes
-rw-r--r--examples/customproxy/doc/src/customproxy.qdoc2
-rw-r--r--examples/customproxy/main.cpp2
-rw-r--r--examples/customproxy/rainfallgraph.cpp20
-rw-r--r--examples/customproxy/rainfallgraph.h2
-rw-r--r--examples/customproxy/variantbardatamapping.cpp2
-rw-r--r--examples/customproxy/variantbardatamapping.h5
-rw-r--r--examples/customproxy/variantbardataproxy.cpp2
-rw-r--r--examples/customproxy/variantbardataproxy.h2
-rw-r--r--examples/customproxy/variantdataset.cpp2
-rw-r--r--examples/customproxy/variantdataset.h5
-rw-r--r--examples/examples.pri62
-rw-r--r--examples/examples.pro7
-rw-r--r--examples/itemmodel/doc/images/itemmodel-example-2.pngbin140466 -> 78536 bytes
-rw-r--r--examples/itemmodel/doc/images/itemmodel-example.pngbin73063 -> 45381 bytes
-rw-r--r--examples/itemmodel/doc/src/itemmodel.qdoc6
-rw-r--r--examples/itemmodel/main.cpp23
-rw-r--r--examples/qmlbars/doc/images/qmlbars-example.pngbin99784 -> 149167 bytes
-rw-r--r--examples/qmlbars/doc/src/qmlbars.qdoc2
-rw-r--r--examples/qmlbars/main.cpp12
-rw-r--r--examples/qmlbars/qml/qmlbars/axes.qml2
-rw-r--r--examples/qmlbars/qml/qmlbars/data.qml3
-rw-r--r--examples/qmlbars/qml/qmlbars/main.qml20
-rw-r--r--examples/qmlcustominput/doc/images/qmlcustominput-example.pngbin116035 -> 57821 bytes
-rw-r--r--examples/qmlcustominput/doc/src/qmlcustominput.qdoc2
-rw-r--r--examples/qmlcustominput/main.cpp12
-rw-r--r--examples/qmlcustominput/qml/qmlcustominput/data.qml3
-rw-r--r--examples/qmlcustominput/qml/qmlcustominput/main.qml2
-rw-r--r--examples/qmlcustominput/qml/qmlcustominput/newbutton.qml2
-rw-r--r--examples/qmllegend/doc/images/qmllegend-example.pngbin0 -> 98023 bytes
-rw-r--r--examples/qmllegend/doc/src/qmllegend.qdoc67
-rw-r--r--examples/qmllegend/main.cpp49
-rw-r--r--examples/qmllegend/qml/qmllegend/data.qml78
-rw-r--r--examples/qmllegend/qml/qmllegend/legenditem.qml118
-rw-r--r--examples/qmllegend/qml/qmllegend/main.qml239
-rw-r--r--examples/qmllegend/qml/qmllegend/newbutton.qml52
-rw-r--r--examples/qmllegend/qmllegend.desktop11
-rw-r--r--examples/qmllegend/qmllegend.pro25
-rw-r--r--examples/qmllegend/qmllegend.qrc8
-rw-r--r--examples/qmllegend/qmllegend64.pngbin0 -> 3400 bytes
-rw-r--r--examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.cpp81
-rw-r--r--examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.pri180
-rw-r--r--examples/qmlmultigraph/doc/images/qmlmultigraph-example.pngbin0 -> 39416 bytes
-rw-r--r--examples/qmlmultigraph/doc/src/qmlmultigraph.qdoc43
-rw-r--r--examples/qmlmultigraph/main.cpp48
-rw-r--r--examples/qmlmultigraph/qml/qmlmultigraph/data.qml76
-rw-r--r--examples/qmlmultigraph/qml/qmlmultigraph/main.qml169
-rw-r--r--examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml52
-rw-r--r--examples/qmlmultigraph/qmlmultigraph.desktop11
-rw-r--r--examples/qmlmultigraph/qmlmultigraph.pro25
-rw-r--r--examples/qmlmultigraph/qmlmultigraph.qrc7
-rw-r--r--examples/qmlmultigraph/qmlmultigraph64.pngbin0 -> 3400 bytes
-rw-r--r--examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.cpp81
-rw-r--r--examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.pri180
-rw-r--r--examples/qmlscatter/doc/images/qmlscatter-example.pngbin60798 -> 98086 bytes
-rw-r--r--examples/qmlscatter/doc/src/qmlscatter.qdoc22
-rw-r--r--examples/qmlscatter/main.cpp14
-rw-r--r--examples/qmlscatter/qml/qmlscatter/data.qml3
-rw-r--r--examples/qmlscatter/qml/qmlscatter/main.qml44
-rw-r--r--examples/qmlscatter/qml/qmlscatter/newbutton.qml2
-rw-r--r--examples/qmlsurface/doc/images/qmlsurface-example.pngbin168723 -> 195500 bytes
-rw-r--r--examples/qmlsurface/doc/src/qmlsurface.qdoc2
-rw-r--r--examples/qmlsurface/main.cpp12
-rw-r--r--examples/qmlsurface/qml/qmlsurface/data.qml3
-rw-r--r--examples/qmlsurface/qml/qmlsurface/main.qml2
-rw-r--r--examples/qmlsurface/qml/qmlsurface/newbutton.qml2
-rw-r--r--examples/scatter/doc/images/scatter-example.pngbin134698 -> 131518 bytes
-rw-r--r--examples/scatter/doc/src/scatter.qdoc2
-rw-r--r--examples/scatter/main.cpp2
-rw-r--r--examples/scatter/scatterdatamodifier.cpp41
-rw-r--r--examples/scatter/scatterdatamodifier.h4
-rw-r--r--examples/surface/doc/images/surface-example.pngbin164522 -> 149046 bytes
-rw-r--r--examples/surface/doc/src/surface.qdoc5
-rw-r--r--examples/surface/main.cpp2
-rw-r--r--examples/surface/surfacegraph.cpp12
-rw-r--r--examples/surface/surfacegraph.h14
-rw-r--r--src/datavisualization/axis/axis.pri18
-rw-r--r--src/datavisualization/axis/qabstract3daxis.cpp (renamed from src/datavisualization/axis/q3dabstractaxis.cpp)105
-rw-r--r--src/datavisualization/axis/qabstract3daxis.h (renamed from src/datavisualization/axis/q3dabstractaxis.h)28
-rw-r--r--src/datavisualization/axis/qabstract3daxis_p.h (renamed from src/datavisualization/axis/q3dabstractaxis_p.h)34
-rw-r--r--src/datavisualization/axis/qcategory3daxis.cpp (renamed from src/datavisualization/axis/q3dcategoryaxis.cpp)64
-rw-r--r--src/datavisualization/axis/qcategory3daxis.h (renamed from src/datavisualization/axis/q3dcategoryaxis.h)26
-rw-r--r--src/datavisualization/axis/qcategory3daxis_p.h (renamed from src/datavisualization/axis/q3dcategoryaxis_p.h)26
-rw-r--r--src/datavisualization/axis/qvalue3daxis.cpp (renamed from src/datavisualization/axis/q3dvalueaxis.cpp)80
-rw-r--r--src/datavisualization/axis/qvalue3daxis.h (renamed from src/datavisualization/axis/q3dvalueaxis.h)35
-rw-r--r--src/datavisualization/axis/qvalue3daxis_p.h (renamed from src/datavisualization/axis/q3dvalueaxis_p.h)26
-rw-r--r--src/datavisualization/data/abstractitemmodelhandler.cpp91
-rw-r--r--src/datavisualization/data/abstractitemmodelhandler_p.h7
-rw-r--r--src/datavisualization/data/abstractrenderitem.cpp7
-rw-r--r--src/datavisualization/data/abstractrenderitem_p.h7
-rw-r--r--src/datavisualization/data/baritemmodelhandler.cpp6
-rw-r--r--src/datavisualization/data/baritemmodelhandler_p.h6
-rw-r--r--src/datavisualization/data/barrenderitem.cpp10
-rw-r--r--src/datavisualization/data/barrenderitem_p.h34
-rw-r--r--src/datavisualization/data/labelitem.cpp6
-rw-r--r--src/datavisualization/data/labelitem_p.h8
-rw-r--r--src/datavisualization/data/qabstract3dseries.cpp186
-rw-r--r--src/datavisualization/data/qabstract3dseries.h20
-rw-r--r--src/datavisualization/data/qabstract3dseries_p.h18
-rw-r--r--src/datavisualization/data/qabstractdataproxy.cpp14
-rw-r--r--src/datavisualization/data/qabstractdataproxy.h11
-rw-r--r--src/datavisualization/data/qabstractdataproxy_p.h8
-rw-r--r--src/datavisualization/data/qbar3dseries.cpp38
-rw-r--r--src/datavisualization/data/qbar3dseries.h8
-rw-r--r--src/datavisualization/data/qbar3dseries_p.h6
-rw-r--r--src/datavisualization/data/qbardataitem.cpp34
-rw-r--r--src/datavisualization/data/qbardataitem.h16
-rw-r--r--src/datavisualization/data/qbardataitem_p.h8
-rw-r--r--src/datavisualization/data/qbardataproxy.cpp20
-rw-r--r--src/datavisualization/data/qbardataproxy.h13
-rw-r--r--src/datavisualization/data/qbardataproxy_p.h8
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy.cpp15
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy.h6
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy_p.h6
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy.cpp48
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy.h6
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy_p.h6
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy.cpp34
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy.h6
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy_p.h6
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy.cpp59
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy.h6
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy_p.h6
-rw-r--r--src/datavisualization/data/qscatter3dseries.cpp42
-rw-r--r--src/datavisualization/data/qscatter3dseries.h9
-rw-r--r--src/datavisualization/data/qscatter3dseries_p.h6
-rw-r--r--src/datavisualization/data/qscatterdataitem.cpp21
-rw-r--r--src/datavisualization/data/qscatterdataitem.h13
-rw-r--r--src/datavisualization/data/qscatterdataitem_p.h8
-rw-r--r--src/datavisualization/data/qscatterdataproxy.cpp12
-rw-r--r--src/datavisualization/data/qscatterdataproxy.h11
-rw-r--r--src/datavisualization/data/qscatterdataproxy_p.h8
-rw-r--r--src/datavisualization/data/qsurface3dseries.cpp44
-rw-r--r--src/datavisualization/data/qsurface3dseries.h10
-rw-r--r--src/datavisualization/data/qsurface3dseries_p.h6
-rw-r--r--src/datavisualization/data/qsurfacedataitem.cpp8
-rw-r--r--src/datavisualization/data/qsurfacedataitem.h9
-rw-r--r--src/datavisualization/data/qsurfacedataitem_p.h8
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.cpp20
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.h13
-rw-r--r--src/datavisualization/data/qsurfacedataproxy_p.h8
-rw-r--r--src/datavisualization/data/scatteritemmodelhandler.cpp102
-rw-r--r--src/datavisualization/data/scatteritemmodelhandler_p.h18
-rw-r--r--src/datavisualization/data/scatterrenderitem.cpp7
-rw-r--r--src/datavisualization/data/scatterrenderitem_p.h40
-rw-r--r--src/datavisualization/data/surfaceitemmodelhandler.cpp8
-rw-r--r--src/datavisualization/data/surfaceitemmodelhandler_p.h6
-rw-r--r--src/datavisualization/datavisualization.pro4
-rw-r--r--src/datavisualization/doc/images/q3dbars-minimal.pngbin16841 -> 14701 bytes
-rw-r--r--src/datavisualization/doc/images/q3dscatter-minimal.pngbin13727 -> 16467 bytes
-rw-r--r--src/datavisualization/doc/images/q3dsurface-minimal.pngbin18691 -> 20622 bytes
-rw-r--r--src/datavisualization/doc/qtdatavisualization.qdocconf7
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp2
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp2
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp2
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp8
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp2
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp2
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro2
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-index.qdoc7
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc45
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc43
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-colorgradient.qdoc2
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc8
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc8
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization.qdoc38
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp327
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h93
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp133
-rw-r--r--src/datavisualization/engine/abstract3drenderer_p.h48
-rw-r--r--src/datavisualization/engine/axisrendercache.cpp10
-rw-r--r--src/datavisualization/engine/axisrendercache_p.h14
-rw-r--r--src/datavisualization/engine/bars3dcontroller.cpp269
-rw-r--r--src/datavisualization/engine/bars3dcontroller_p.h43
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp433
-rw-r--r--src/datavisualization/engine/bars3drenderer_p.h28
-rw-r--r--src/datavisualization/engine/drawer.cpp110
-rw-r--r--src/datavisualization/engine/drawer_p.h12
-rw-r--r--src/datavisualization/engine/engine.pri6
-rw-r--r--src/datavisualization/engine/engine.qrc2
-rw-r--r--src/datavisualization/engine/meshes/arrowFlat.obj403
-rw-r--r--src/datavisualization/engine/meshes/arrowSmooth.obj422
-rw-r--r--src/datavisualization/engine/q3dbars.cpp283
-rw-r--r--src/datavisualization/engine/q3dbars.h92
-rw-r--r--src/datavisualization/engine/q3dbars_p.h16
-rw-r--r--src/datavisualization/engine/q3dbox.cpp12
-rw-r--r--src/datavisualization/engine/q3dbox.h180
-rw-r--r--src/datavisualization/engine/q3dcamera.cpp9
-rw-r--r--src/datavisualization/engine/q3dcamera.h9
-rw-r--r--src/datavisualization/engine/q3dcamera_p.h8
-rw-r--r--src/datavisualization/engine/q3dlight.cpp6
-rw-r--r--src/datavisualization/engine/q3dlight.h8
-rw-r--r--src/datavisualization/engine/q3dlight_p.h8
-rw-r--r--src/datavisualization/engine/q3dobject.cpp10
-rw-r--r--src/datavisualization/engine/q3dobject.h9
-rw-r--r--src/datavisualization/engine/q3dobject_p.h8
-rw-r--r--src/datavisualization/engine/q3dscatter.cpp215
-rw-r--r--src/datavisualization/engine/q3dscatter.h74
-rw-r--r--src/datavisualization/engine/q3dscatter_p.h16
-rw-r--r--src/datavisualization/engine/q3dscene.cpp83
-rw-r--r--src/datavisualization/engine/q3dscene.h16
-rw-r--r--src/datavisualization/engine/q3dscene_p.h9
-rw-r--r--src/datavisualization/engine/q3dsurface.cpp205
-rw-r--r--src/datavisualization/engine/q3dsurface.h70
-rw-r--r--src/datavisualization/engine/q3dsurface_p.h17
-rw-r--r--src/datavisualization/engine/q3dwindow.cpp250
-rw-r--r--src/datavisualization/engine/q3dwindow.h65
-rw-r--r--src/datavisualization/engine/qabstract3dgraph.cpp512
-rw-r--r--src/datavisualization/engine/qabstract3dgraph.h130
-rw-r--r--src/datavisualization/engine/qabstract3dgraph_p.h (renamed from src/datavisualization/engine/q3dwindow_p.h)29
-rw-r--r--src/datavisualization/engine/scatter3dcontroller.cpp176
-rw-r--r--src/datavisualization/engine/scatter3dcontroller_p.h47
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp209
-rw-r--r--src/datavisualization/engine/scatter3drenderer_p.h22
-rw-r--r--src/datavisualization/engine/selectionpointer.cpp35
-rw-r--r--src/datavisualization/engine/selectionpointer_p.h28
-rw-r--r--src/datavisualization/engine/seriesrendercache.cpp20
-rw-r--r--src/datavisualization/engine/seriesrendercache_p.h12
-rw-r--r--src/datavisualization/engine/shaders/colorOnY.frag5
-rw-r--r--src/datavisualization/engine/shaders/colorOnY_ES2.frag5
-rw-r--r--src/datavisualization/engine/shaders/default.frag5
-rw-r--r--src/datavisualization/engine/shaders/default_ES2.frag5
-rw-r--r--src/datavisualization/engine/shaders/shadow.frag27
-rw-r--r--src/datavisualization/engine/shaders/shadowNoTex.frag44
-rw-r--r--src/datavisualization/engine/shaders/shadowNoTexColorOnY.frag26
-rw-r--r--src/datavisualization/engine/shaders/surface.frag5
-rw-r--r--src/datavisualization/engine/shaders/surfaceFlat.frag5
-rw-r--r--src/datavisualization/engine/shaders/surfaceShadowFlat.frag8
-rw-r--r--src/datavisualization/engine/shaders/surfaceShadowNoTex.frag8
-rw-r--r--src/datavisualization/engine/shaders/surface_ES2.frag5
-rw-r--r--src/datavisualization/engine/surface3dcontroller.cpp148
-rw-r--r--src/datavisualization/engine/surface3dcontroller_p.h21
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp244
-rw-r--r--src/datavisualization/engine/surface3drenderer_p.h26
-rw-r--r--src/datavisualization/global/datavisualizationglobal_p.h17
-rw-r--r--src/datavisualization/global/global.pri1
-rw-r--r--src/datavisualization/global/qdatavisualizationenums.h63
-rw-r--r--src/datavisualization/global/qdatavisualizationglobal.h15
-rw-r--r--src/datavisualization/global/qtdatavisualizationenums.qdoc90
-rw-r--r--src/datavisualization/input/q3dinputhandler.cpp78
-rw-r--r--src/datavisualization/input/q3dinputhandler.h12
-rw-r--r--src/datavisualization/input/q3dinputhandler_p.h15
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.cpp52
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.h31
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler_p.h18
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.cpp78
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.h8
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler_p.h10
-rw-r--r--src/datavisualization/theme/builtin3dthemes.cpp230
-rw-r--r--src/datavisualization/theme/builtin3dthemes_p.h87
-rw-r--r--src/datavisualization/theme/q3dtheme.cpp89
-rw-r--r--src/datavisualization/theme/q3dtheme.h14
-rw-r--r--src/datavisualization/theme/q3dtheme_p.h25
-rw-r--r--src/datavisualization/theme/thememanager.cpp609
-rw-r--r--src/datavisualization/theme/thememanager_p.h63
-rw-r--r--src/datavisualization/utils/abstractobjecthelper.cpp6
-rw-r--r--src/datavisualization/utils/abstractobjecthelper_p.h8
-rw-r--r--src/datavisualization/utils/camerahelper.cpp34
-rw-r--r--src/datavisualization/utils/camerahelper_p.h10
-rw-r--r--src/datavisualization/utils/meshloader.cpp13
-rw-r--r--src/datavisualization/utils/meshloader_p.h7
-rw-r--r--src/datavisualization/utils/objecthelper.cpp8
-rw-r--r--src/datavisualization/utils/objecthelper_p.h6
-rw-r--r--src/datavisualization/utils/qutils.h48
-rw-r--r--src/datavisualization/utils/shaderhelper.cpp14
-rw-r--r--src/datavisualization/utils/shaderhelper_p.h8
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp17
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h10
-rw-r--r--src/datavisualization/utils/texturehelper.cpp8
-rw-r--r--src/datavisualization/utils/texturehelper_p.h6
-rw-r--r--src/datavisualization/utils/utils.cpp32
-rw-r--r--src/datavisualization/utils/utils.pri3
-rw-r--r--src/datavisualization/utils/utils_p.h7
-rw-r--r--src/datavisualization/utils/vertexindexer.cpp21
-rw-r--r--src/datavisualization/utils/vertexindexer_p.h10
-rw-r--r--src/datavisualizationqml2/abstractdeclarative.cpp111
-rw-r--r--src/datavisualizationqml2/abstractdeclarative_p.h75
-rw-r--r--src/datavisualizationqml2/colorgradient.cpp6
-rw-r--r--src/datavisualizationqml2/colorgradient_p.h6
-rw-r--r--src/datavisualizationqml2/datavisualizationqml2.pro12
-rw-r--r--src/datavisualizationqml2/datavisualizationqml2_plugin.cpp22
-rw-r--r--src/datavisualizationqml2/datavisualizationqml2_plugin.h23
-rw-r--r--src/datavisualizationqml2/declarativebars.cpp85
-rw-r--r--src/datavisualizationqml2/declarativebars_p.h49
-rw-r--r--src/datavisualizationqml2/declarativecolor.cpp6
-rw-r--r--src/datavisualizationqml2/declarativecolor_p.h6
-rw-r--r--src/datavisualizationqml2/declarativescatter.cpp54
-rw-r--r--src/datavisualizationqml2/declarativescatter_p.h37
-rw-r--r--src/datavisualizationqml2/declarativescene.cpp49
-rw-r--r--src/datavisualizationqml2/declarativescene_p.h60
-rw-r--r--src/datavisualizationqml2/declarativeseries.cpp11
-rw-r--r--src/datavisualizationqml2/declarativeseries_p.h25
-rw-r--r--src/datavisualizationqml2/declarativesurface.cpp56
-rw-r--r--src/datavisualizationqml2/declarativesurface_p.h37
-rw-r--r--src/datavisualizationqml2/declarativetheme.cpp39
-rw-r--r--src/datavisualizationqml2/declarativetheme_p.h18
-rw-r--r--src/datavisualizationqml2/qmldir1
-rw-r--r--tests/barstest/barstest.pro4
-rw-r--r--tests/barstest/chart.cpp499
-rw-r--r--tests/barstest/chart.h43
-rw-r--r--tests/barstest/custominputhandler.cpp54
-rw-r--r--tests/barstest/custominputhandler.h36
-rw-r--r--tests/barstest/main.cpp40
-rw-r--r--tests/directional/directional.pro10
-rw-r--r--tests/directional/main.cpp170
-rw-r--r--tests/directional/scatterdatamodifier.cpp210
-rw-r--r--tests/directional/scatterdatamodifier.h68
-rw-r--r--tests/kinectsurface/main.cpp2
-rw-r--r--tests/kinectsurface/surfacedata.cpp105
-rw-r--r--tests/kinectsurface/surfacedata.h2
-rw-r--r--tests/minimalbars/minimalbars.pro6
-rw-r--r--tests/minimalscatter/minimalscatter.pro6
-rw-r--r--tests/minimalsurface/minimalsurface.pro6
-rw-r--r--tests/multigraphs/data.cpp57
-rw-r--r--tests/multigraphs/data.h2
-rw-r--r--tests/multigraphs/main.cpp2
-rw-r--r--tests/qmlcamera/main.cpp12
-rw-r--r--tests/qmlcamera/qml/qmlcamera/Axes.qml2
-rw-r--r--tests/qmlcamera/qml/qmlcamera/ControlSurface.qml2
-rw-r--r--tests/qmlcamera/qml/qmlcamera/Data.qml2
-rw-r--r--tests/qmlcamera/qml/qmlcamera/main.qml2
-rw-r--r--tests/qmldynamicdata/main.cpp12
-rw-r--r--tests/qmldynamicdata/qml/qmldynamicdata/main.qml24
-rw-r--r--tests/qmldynamicdata/qml/qmldynamicdata/newbutton.qml2
-rw-r--r--tests/qmldynamicdata/qmldynamicdata.pro2
-rw-r--r--tests/scattertest/main.cpp14
-rw-r--r--tests/scattertest/scatterchart.cpp84
-rw-r--r--tests/scattertest/scatterchart.h10
-rw-r--r--tests/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp2
-rw-r--r--tests/spectrum/3rdparty/fftreal/fftreal_wrapper.h2
-rw-r--r--tests/spectrum/spectrumapp/engine.cpp2
-rw-r--r--tests/spectrum/spectrumapp/engine.h2
-rw-r--r--tests/spectrum/spectrumapp/frequencyspectrum.cpp2
-rw-r--r--tests/spectrum/spectrumapp/frequencyspectrum.h2
-rw-r--r--tests/spectrum/spectrumapp/main.cpp14
-rw-r--r--tests/spectrum/spectrumapp/spectrum.h2
-rw-r--r--tests/spectrum/spectrumapp/spectrumanalyser.cpp2
-rw-r--r--tests/spectrum/spectrumapp/spectrumanalyser.h2
-rw-r--r--tests/spectrum/spectrumapp/utils.cpp2
-rw-r--r--tests/spectrum/spectrumapp/utils.h2
-rw-r--r--tests/spectrum/spectrumapp/wavfile.cpp2
-rw-r--r--tests/spectrum/spectrumapp/wavfile.h2
-rw-r--r--tests/surfacetest/graphmodifier.cpp55
-rw-r--r--tests/surfacetest/graphmodifier.h6
-rw-r--r--tests/surfacetest/main.cpp28
-rw-r--r--tests/tests.pri74
-rw-r--r--tests/tests.pro6
369 files changed, 9441 insertions, 4939 deletions
diff --git a/README b/README
index acd34527..6a414903 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-----------------------------------
-Qt Data Visualization 1.0.0 (alpha)
+Qt Data Visualization 1.0.0 (beta)
-----------------------------------
Qt Data Visualization module provides multiple graph types to visualize data in 3D space
@@ -12,7 +12,7 @@ System Requirements
- OpenGL 2.1 or newer (recommended) or OpenGL ES2 (reduced feature set)
Platform specific recommendations:
-- Mac: OSX 10.8 recommended
+- Mac: OSX 10.8 or later recommended
Building
========
@@ -68,7 +68,7 @@ The documentation can also be generated with:
make docs
Please refer to the generated documentation for more information:
- doc/qtdatavisualization/qtdatavisualization-index.html
+ doc/qtdatavisualization/index.html
Known Issues
============
@@ -79,16 +79,13 @@ Known Issues
For example, Qt Creator application wizard for Qt Quick 2 applications
creates by default an opaque white Rectangle element as the main element,
which covers any graph added to it.
-- Using multiple graphs in one application crashes on application shutdown
- unless the last graph to have active context is deleted last.
- Android doesn't support both widgets and OpenGL simultaneously, so only
the Qt Quick 2 API is usable in practice in Android.
- Shadows are not supported with OpenGL ES2 (including Angle builds in Windows).
- Anti-aliasing doesn't work with OpenGL ES2 (including Angle builds in Windows).
- Surfaces with non-straight rows and columns do not always render properly.
-- Wrong item can end up selected if you do mouse selection and data removes/inserts
- simultaneously due to the asynchronous nature of mouse selection handling.
- Q3DLight class (and Light3D QML item) are currently not usable for anything.
- Q3DScene::secondarySubviewOnTop property has currently no effect.
- The color style Q3DTheme::ColorStyleObjectGradient doesn't work for surface graphs.
- Scatter "point" meshes do not support gradients, they always use the base color.
+- Widget based examples layout incorrectly in iOS.
diff --git a/examples/audiolevels/audiolevels.cpp b/examples/audiolevels/audiolevels.cpp
index 3677c1f1..18c1342a 100644
--- a/examples/audiolevels/audiolevels.cpp
+++ b/examples/audiolevels/audiolevels.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "audiolevels.h"
#include <QtDataVisualization/qbardataproxy.h>
-#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/qvalue3daxis.h>
#include <QtDataVisualization/q3dscene.h>
#include <QtDataVisualization/q3dcamera.h>
#include <QtDataVisualization/qbar3dseries.h>
@@ -29,7 +29,7 @@
#include <QAudioDeviceInfo>
#include <QAudioInput>
-QT_DATAVISUALIZATION_USE_NAMESPACE
+using namespace QtDataVisualization;
AudioLevels::AudioLevels(Q3DBars *graph, QObject *parent)
: QObject(parent),
@@ -43,30 +43,31 @@ AudioLevels::AudioLevels(Q3DBars *graph, QObject *parent)
m_graph->valueAxis()->setRange(-100.0f, 100.0f);
m_graph->valueAxis()->setSegmentCount(20);
m_graph->valueAxis()->setLabelFormat(QStringLiteral("%d%%"));
- m_graph->setShadowQuality(QDataVis::ShadowQualityNone);
- m_graph->setSelectionMode(QDataVis::SelectionNone);
+ m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualityNone);
+ m_graph->setSelectionMode(QAbstract3DGraph::SelectionNone);
m_graph->scene()->activeCamera()->setCameraPosition(-25.0f, 10.0f, 190.0f);
- m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle));
- m_graph->theme()->setGridEnabled(true);
- m_graph->theme()->setBackgroundEnabled(false);
- QFont font = m_graph->theme()->font();
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeIsabelle);
+ m_graph->activeTheme()->setGridEnabled(true);
+ m_graph->activeTheme()->setBackgroundEnabled(false);
+ QFont font = m_graph->activeTheme()->font();
font.setPointSize(10);
- m_graph->theme()->setFont(font);
+ m_graph->activeTheme()->setFont(font);
QBar3DSeries *series = new QBar3DSeries;
series->setMesh(QAbstract3DSeries::MeshBar);
m_graph->addSeries(series);
//! [0]
+ QAudioDeviceInfo inputDevice = QAudioDeviceInfo::defaultInputDevice();
+
QAudioFormat formatAudio;
- formatAudio.setSampleRate(8000);
- formatAudio.setChannelCount(1);
- formatAudio.setSampleSize(8);
- formatAudio.setCodec("audio/pcm");
+ formatAudio.setSampleRate(inputDevice.supportedSampleRates().at(0));
+ formatAudio.setChannelCount(inputDevice.supportedChannelCounts().at(0));
+ formatAudio.setSampleSize(inputDevice.supportedSampleSizes().at(0));
+ formatAudio.setCodec(inputDevice.supportedCodecs().at(0));
formatAudio.setByteOrder(QAudioFormat::LittleEndian);
formatAudio.setSampleType(QAudioFormat::UnSignedInt);
- QAudioDeviceInfo inputDevices = QAudioDeviceInfo::defaultInputDevice();
- m_audioInput = new QAudioInput(inputDevices, formatAudio, this);
+ m_audioInput = new QAudioInput(inputDevice, formatAudio, this);
#ifdef Q_OS_MAC
// Mac seems to wait for entire buffer to fill before calling writeData, so use smaller buffer
m_audioInput->setBufferSize(256);
diff --git a/examples/audiolevels/audiolevels.h b/examples/audiolevels/audiolevels.h
index db1d8936..84d9b4c4 100644
--- a/examples/audiolevels/audiolevels.h
+++ b/examples/audiolevels/audiolevels.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -21,7 +21,7 @@
#include <QtDataVisualization/q3dbars.h>
-QT_DATAVISUALIZATION_USE_NAMESPACE
+using namespace QtDataVisualization;
class AudioLevelsIODevice;
class QAudioInput;
diff --git a/examples/audiolevels/audiolevelsiodevice.cpp b/examples/audiolevels/audiolevelsiodevice.cpp
index e4576638..c0cd70e3 100644
--- a/examples/audiolevels/audiolevelsiodevice.cpp
+++ b/examples/audiolevels/audiolevelsiodevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "audiolevelsiodevice.h"
#include <QDebug>
-QT_DATAVISUALIZATION_USE_NAMESPACE
+using namespace QtDataVisualization;
//! [1]
static const int resolution = 8;
diff --git a/examples/audiolevels/audiolevelsiodevice.h b/examples/audiolevels/audiolevelsiodevice.h
index 8d665fe8..45f17626 100644
--- a/examples/audiolevels/audiolevelsiodevice.h
+++ b/examples/audiolevels/audiolevelsiodevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -22,7 +22,7 @@
#include <QtDataVisualization/qbardataproxy.h>
#include <QIODevice>
-QT_DATAVISUALIZATION_USE_NAMESPACE
+using namespace QtDataVisualization;
class AudioLevelsIODevice : public QIODevice
{
diff --git a/examples/audiolevels/doc/images/audiolevels-example.png b/examples/audiolevels/doc/images/audiolevels-example.png
index 58566545..ec79eb5a 100644
--- a/examples/audiolevels/doc/images/audiolevels-example.png
+++ b/examples/audiolevels/doc/images/audiolevels-example.png
Binary files differ
diff --git a/examples/audiolevels/doc/src/audiolevels.qdoc b/examples/audiolevels/doc/src/audiolevels.qdoc
index d52b2e25..189db184 100644
--- a/examples/audiolevels/doc/src/audiolevels.qdoc
+++ b/examples/audiolevels/doc/src/audiolevels.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/audiolevels/main.cpp b/examples/audiolevels/main.cpp
index 36922aa6..9dd07b1b 100644
--- a/examples/audiolevels/main.cpp
+++ b/examples/audiolevels/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/bars/doc/images/bars-example.png b/examples/bars/doc/images/bars-example.png
index e8b91314..6cc94455 100644
--- a/examples/bars/doc/images/bars-example.png
+++ b/examples/bars/doc/images/bars-example.png
Binary files differ
diff --git a/examples/bars/doc/src/bars.qdoc b/examples/bars/doc/src/bars.qdoc
index 79cfb270..9c80b804 100644
--- a/examples/bars/doc/src/bars.qdoc
+++ b/examples/bars/doc/src/bars.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -75,7 +75,7 @@
Let's take a closer look at parts of the code.
- First we're creating the axes and the proxy into member variables to support changing them
+ First we're creating the axes and the series into member variables to support changing them
easily later on, if we want to:
\snippet ../examples/bars/graphmodifier.cpp 1
@@ -88,8 +88,8 @@
\snippet ../examples/bars/graphmodifier.cpp 3
- Next we create two series for the graph, giving each one a data proxy. Here we also initialize
- some of the visual properties of the series. Note that the second series is initially not visible:
+ Next we initialize the visual properties of the series.
+ Note that the second series is initially not visible:
\snippet ../examples/bars/graphmodifier.cpp 8
diff --git a/examples/bars/graphmodifier.cpp b/examples/bars/graphmodifier.cpp
index 13e4d3e7..06b36b7f 100644
--- a/examples/bars/graphmodifier.cpp
+++ b/examples/bars/graphmodifier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,8 +17,8 @@
****************************************************************************/
#include "graphmodifier.h"
-#include <QtDataVisualization/q3dcategoryaxis.h>
-#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/qcategory3daxis.h>
+#include <QtDataVisualization/qvalue3daxis.h>
#include <QtDataVisualization/qbardataproxy.h>
#include <QtDataVisualization/q3dscene.h>
#include <QtDataVisualization/q3dcamera.h>
@@ -27,7 +27,7 @@
#include <QTime>
#include <QComboBox>
-QT_DATAVISUALIZATION_USE_NAMESPACE
+using namespace QtDataVisualization;
const QString celsiusString = QString(QChar(0xB0)) + "C";
@@ -42,21 +42,21 @@ GraphModifier::GraphModifier(Q3DBars *bargraph)
m_minval(-20.0f),
m_maxval(20.0f),
//! [1]
- m_temperatureAxis(new Q3DValueAxis),
- m_yearAxis(new Q3DCategoryAxis),
- m_monthAxis(new Q3DCategoryAxis),
- m_primaryData(new QBarDataProxy),
- m_secondaryData(new QBarDataProxy),
+ m_temperatureAxis(new QValue3DAxis),
+ m_yearAxis(new QCategory3DAxis),
+ m_monthAxis(new QCategory3DAxis),
+ m_primarySeries(new QBar3DSeries),
+ m_secondarySeries(new QBar3DSeries),
//! [1]
- m_primaryStyle(QAbstract3DSeries::MeshBevelBar),
- m_secondaryStyle(QAbstract3DSeries::MeshSphere),
+ m_barMesh(QAbstract3DSeries::MeshBevelBar),
m_smooth(false)
{
//! [2]
- m_graph->setShadowQuality(QDataVis::ShadowQualitySoftMedium);
- m_graph->theme()->setBackgroundEnabled(false);
- m_graph->theme()->setFont(QFont("Times New Roman", m_fontSize));
- m_graph->theme()->setLabelBackgroundEnabled(true);
+ m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftMedium);
+ m_graph->activeTheme()->setBackgroundEnabled(false);
+ m_graph->activeTheme()->setFont(QFont("Times New Roman", m_fontSize));
+ m_graph->activeTheme()->setLabelBackgroundEnabled(true);
+ m_graph->setMultiSeriesUniform(true);
//! [2]
m_months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December";
@@ -78,21 +78,19 @@ GraphModifier::GraphModifier(Q3DBars *bargraph)
//! [3]
//! [8]
- QBar3DSeries *series = new QBar3DSeries(m_primaryData);
- series->setItemLabelFormat(QStringLiteral("Oulu - @colLabel @rowLabel: @valueLabel"));
- series->setMesh(QAbstract3DSeries::MeshBevelBar);
- series->setMeshSmooth(false);
-
- QBar3DSeries *series2 = new QBar3DSeries(m_secondaryData);
- series2->setItemLabelFormat(QStringLiteral("Helsinki - @colLabel @rowLabel: @valueLabel"));
- series2->setMesh(QAbstract3DSeries::MeshSphere);
- series2->setMeshSmooth(false);
- series2->setVisible(false);
+ m_primarySeries->setItemLabelFormat(QStringLiteral("Oulu - @colLabel @rowLabel: @valueLabel"));
+ m_primarySeries->setMesh(QAbstract3DSeries::MeshBevelBar);
+ m_primarySeries->setMeshSmooth(false);
+
+ m_secondarySeries->setItemLabelFormat(QStringLiteral("Helsinki - @colLabel @rowLabel: @valueLabel"));
+ m_secondarySeries->setMesh(QAbstract3DSeries::MeshBevelBar);
+ m_secondarySeries->setMeshSmooth(false);
+ m_secondarySeries->setVisible(false);
//! [8]
//! [4]
- m_graph->addSeries(series);
- m_graph->addSeries(series2);
+ m_graph->addSeries(m_primarySeries);
+ m_graph->addSeries(m_secondarySeries);
//! [4]
//! [6]
@@ -155,9 +153,9 @@ void GraphModifier::resetTemperatureData()
dataSet2->append(dataRow2);
}
- // Add data to the graph (the graph assumes ownership of it)
- m_primaryData->resetArray(dataSet, m_years, m_months);
- m_secondaryData->resetArray(dataSet2, m_years, m_months);
+ // Add data to the data proxy (the data proxy assumes ownership of it)
+ m_primarySeries->dataProxy()->resetArray(dataSet, m_years, m_months);
+ m_secondarySeries->dataProxy()->resetArray(dataSet2, m_years, m_months);
//! [5]
}
@@ -165,9 +163,9 @@ void GraphModifier::changeStyle(int style)
{
QComboBox *comboBox = qobject_cast<QComboBox *>(sender());
if (comboBox) {
- m_primaryStyle = QAbstract3DSeries::Mesh(comboBox->itemData(style).toInt());
- if (m_graph->seriesList().size())
- m_graph->seriesList().at(0)->setMesh(m_primaryStyle);
+ m_barMesh = QAbstract3DSeries::Mesh(comboBox->itemData(style).toInt());
+ m_primarySeries->setMesh(m_barMesh);
+ m_secondarySeries->setMesh(m_barMesh);
}
}
@@ -185,16 +183,17 @@ void GraphModifier::changePresetCamera()
void GraphModifier::changeTheme(int theme)
{
- m_graph->setTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
- emit backgroundEnabledChanged(m_graph->theme()->isBackgroundEnabled());
- emit gridEnabledChanged(m_graph->theme()->isGridEnabled());
- emit fontChanged(m_graph->theme()->font());
- emit fontSizeChanged(m_graph->theme()->font().pointSize());
+ Q3DTheme *currentTheme = m_graph->activeTheme();
+ currentTheme->setType(Q3DTheme::Theme(theme));
+ emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
+ emit gridEnabledChanged(currentTheme->isGridEnabled());
+ emit fontChanged(currentTheme->font());
+ emit fontSizeChanged(currentTheme->font().pointSize());
}
void GraphModifier::changeLabelBackground()
{
- m_graph->theme()->setLabelBackgroundEnabled(!m_graph->theme()->isLabelBackgroundEnabled());
+ m_graph->activeTheme()->setLabelBackgroundEnabled(!m_graph->activeTheme()->isLabelBackgroundEnabled());
}
void GraphModifier::changeSelectionMode(int selectionMode)
@@ -202,25 +201,25 @@ void GraphModifier::changeSelectionMode(int selectionMode)
QComboBox *comboBox = qobject_cast<QComboBox *>(sender());
if (comboBox) {
int flags = comboBox->itemData(selectionMode).toInt();
- m_graph->setSelectionMode(QDataVis::SelectionFlags(flags));
+ m_graph->setSelectionMode(QAbstract3DGraph::SelectionFlags(flags));
}
}
void GraphModifier::changeFont(const QFont &font)
{
QFont newFont = font;
- m_graph->theme()->setFont(newFont);
+ m_graph->activeTheme()->setFont(newFont);
}
void GraphModifier::changeFontSize(int fontsize)
{
m_fontSize = fontsize;
- QFont font = m_graph->theme()->font();
+ QFont font = m_graph->activeTheme()->font();
font.setPointSize(m_fontSize);
- m_graph->theme()->setFont(font);
+ m_graph->activeTheme()->setFont(font);
}
-void GraphModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq)
+void GraphModifier::shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality sq)
{
int quality = int(sq);
// Updates the UI component to show correct shadow quality
@@ -229,7 +228,7 @@ void GraphModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq)
void GraphModifier::changeShadowQuality(int quality)
{
- QDataVis::ShadowQuality sq = QDataVis::ShadowQuality(quality);
+ QAbstract3DGraph::ShadowQuality sq = QAbstract3DGraph::ShadowQuality(quality);
m_graph->setShadowQuality(sq);
emit shadowQualityChanged(quality);
}
@@ -250,31 +249,22 @@ void GraphModifier::rotateY(int rotation)
void GraphModifier::setBackgroundEnabled(int enabled)
{
- m_graph->theme()->setBackgroundEnabled(bool(enabled));
+ m_graph->activeTheme()->setBackgroundEnabled(bool(enabled));
}
void GraphModifier::setGridEnabled(int enabled)
{
- m_graph->theme()->setGridEnabled(bool(enabled));
+ m_graph->activeTheme()->setGridEnabled(bool(enabled));
}
void GraphModifier::setSmoothBars(int smooth)
{
m_smooth = bool(smooth);
- if (m_graph->seriesList().size()) {
- m_graph->seriesList().at(0)->setMeshSmooth(m_smooth);
- m_graph->seriesList().at(1)->setMeshSmooth(m_smooth);
- }
+ m_primarySeries->setMeshSmooth(m_smooth);
+ m_secondarySeries->setMeshSmooth(m_smooth);
}
void GraphModifier::setSeriesVisibility(int enabled)
{
- m_graph->seriesList().at(1)->setVisible(bool(enabled));
- if (enabled) {
- m_graph->setBarThickness(2.0f);
- m_graph->setBarSpacing(QSizeF(1.0, 3.0));
- } else {
- m_graph->setBarThickness(1.0f);
- m_graph->setBarSpacing(QSizeF(1.0, 1.0));
- }
+ m_secondarySeries->setVisible(bool(enabled));
}
diff --git a/examples/bars/graphmodifier.h b/examples/bars/graphmodifier.h
index f7c0acaf..cfb1ceec 100644
--- a/examples/bars/graphmodifier.h
+++ b/examples/bars/graphmodifier.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -54,7 +54,7 @@ public slots:
void changeSelectionMode(int selectionMode);
void changeTheme(int theme);
void changeShadowQuality(int quality);
- void shadowQualityUpdatedByVisual(QDataVis::ShadowQuality shadowQuality);
+ void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality);
signals:
void shadowQualityChanged(int quality);
@@ -74,13 +74,12 @@ private:
float m_maxval;
QStringList m_months;
QStringList m_years;
- Q3DValueAxis *m_temperatureAxis;
- Q3DCategoryAxis *m_yearAxis;
- Q3DCategoryAxis *m_monthAxis;
- QBarDataProxy *m_primaryData;
- QBarDataProxy *m_secondaryData;
- QAbstract3DSeries::Mesh m_primaryStyle;
- QAbstract3DSeries::Mesh m_secondaryStyle;
+ QValue3DAxis *m_temperatureAxis;
+ QCategory3DAxis *m_yearAxis;
+ QCategory3DAxis *m_monthAxis;
+ QBar3DSeries *m_primarySeries;
+ QBar3DSeries *m_secondarySeries;
+ QAbstract3DSeries::Mesh m_barMesh;
bool m_smooth;
};
diff --git a/examples/bars/main.cpp b/examples/bars/main.cpp
index 21a4e0e6..0b934aac 100644
--- a/examples/bars/main.cpp
+++ b/examples/bars/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -86,38 +86,38 @@ int main(int argc, char **argv)
QComboBox *selectionModeList = new QComboBox(widget);
selectionModeList->addItem(QStringLiteral("None"),
- int(QDataVis::SelectionNone));
+ int(QAbstract3DGraph::SelectionNone));
selectionModeList->addItem(QStringLiteral("Bar"),
- int(QDataVis::SelectionItem));
+ int(QAbstract3DGraph::SelectionItem));
selectionModeList->addItem(QStringLiteral("Row"),
- int(QDataVis::SelectionRow));
+ int(QAbstract3DGraph::SelectionRow));
selectionModeList->addItem(QStringLiteral("Bar and Row"),
- int(QDataVis::SelectionItemAndRow));
+ int(QAbstract3DGraph::SelectionItemAndRow));
selectionModeList->addItem(QStringLiteral("Column"),
- int(QDataVis::SelectionColumn));
+ int(QAbstract3DGraph::SelectionColumn));
selectionModeList->addItem(QStringLiteral("Bar and Column"),
- int(QDataVis::SelectionItemAndColumn));
+ int(QAbstract3DGraph::SelectionItemAndColumn));
selectionModeList->addItem(QStringLiteral("Row and Column"),
- int(QDataVis::SelectionRowAndColumn));
+ int(QAbstract3DGraph::SelectionRowAndColumn));
selectionModeList->addItem(QStringLiteral("Bar, Row and Column"),
- int(QDataVis::SelectionItemRowAndColumn));
+ int(QAbstract3DGraph::SelectionItemRowAndColumn));
selectionModeList->addItem(QStringLiteral("Slice into Row"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionRow));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow));
selectionModeList->addItem(QStringLiteral("Slice into Row and Item"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionItemAndRow));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow));
selectionModeList->addItem(QStringLiteral("Slice into Column"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionColumn));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn));
selectionModeList->addItem(QStringLiteral("Slice into Column and Item"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionItemAndColumn));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn));
selectionModeList->addItem(QStringLiteral("Multi: Bar, Row, Col"),
- int(QDataVis::SelectionItemRowAndColumn
- | QDataVis::SelectionMultiSeries));
+ int(QAbstract3DGraph::SelectionItemRowAndColumn
+ | QAbstract3DGraph::SelectionMultiSeries));
selectionModeList->addItem(QStringLiteral("Multi, Slice: Row, Item"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionItemAndRow
- | QDataVis::SelectionMultiSeries));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow
+ | QAbstract3DGraph::SelectionMultiSeries));
selectionModeList->addItem(QStringLiteral("Multi, Slice: Col, Item"),
- int(QDataVis::SelectionSlice | QDataVis::SelectionItemAndColumn
- | QDataVis::SelectionMultiSeries));
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn
+ | QAbstract3DGraph::SelectionMultiSeries));
selectionModeList->setCurrentIndex(1);
QCheckBox *backgroundCheckBox = new QCheckBox(widget);
diff --git a/examples/custominput/custominputhandler.cpp b/examples/custominput/custominputhandler.cpp
index 3b050fda..a5734e16 100644
--- a/examples/custominput/custominputhandler.cpp
+++ b/examples/custominput/custominputhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/custominput/custominputhandler.h b/examples/custominput/custominputhandler.h
index 1fecb8d8..60c88ef7 100644
--- a/examples/custominput/custominputhandler.h
+++ b/examples/custominput/custominputhandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/custominput/doc/images/custominput-example.png b/examples/custominput/doc/images/custominput-example.png
index 083bac58..b2656b69 100644
--- a/examples/custominput/doc/images/custominput-example.png
+++ b/examples/custominput/doc/images/custominput-example.png
Binary files differ
diff --git a/examples/custominput/doc/src/custominput.qdoc b/examples/custominput/doc/src/custominput.qdoc
index 9bb5607f..88c53b4d 100644
--- a/examples/custominput/doc/src/custominput.qdoc
+++ b/examples/custominput/doc/src/custominput.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/custominput/main.cpp b/examples/custominput/main.cpp
index 8b1aa033..069a5b0a 100644
--- a/examples/custominput/main.cpp
+++ b/examples/custominput/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/custominput/scatterdatamodifier.cpp b/examples/custominput/scatterdatamodifier.cpp
index aabb1b3a..a2a5bea9 100644
--- a/examples/custominput/scatterdatamodifier.cpp
+++ b/examples/custominput/scatterdatamodifier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "scatterdatamodifier.h"
#include <QtDataVisualization/QScatterDataProxy>
-#include <QtDataVisualization/Q3DValueAxis>
+#include <QtDataVisualization/QValue3DAxis>
#include <QtDataVisualization/Q3DScene>
#include <QtDataVisualization/Q3DCamera>
#include <QtDataVisualization/QScatter3DSeries>
@@ -32,20 +32,20 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
: m_graph(scatter),
m_inputHandler(new CustomInputHandler())
{
- m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
- m_graph->setShadowQuality(QDataVis::ShadowQualityMedium);
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
+ m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualityMedium);
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront);
- m_graph->setAxisX(new Q3DValueAxis);
- m_graph->setAxisY(new Q3DValueAxis);
- m_graph->setAxisZ(new Q3DValueAxis);
+ m_graph->setAxisX(new QValue3DAxis);
+ m_graph->setAxisY(new QValue3DAxis);
+ m_graph->setAxisZ(new QValue3DAxis);
m_graph->axisX()->setRange(-10.0f, 10.0f);
m_graph->axisY()->setRange(-5.0f, 5.0f);
m_graph->axisZ()->setRange(-5.0f, 5.0f);
QScatter3DSeries *series = new QScatter3DSeries;
- series->setItemLabelFormat("@xLabel, @yLabel, @zLabel");
+ series->setItemLabelFormat(QStringLiteral("@xLabel, @yLabel, @zLabel"));
series->setMesh(QAbstract3DSeries::MeshCube);
series->setItemSize(0.15f);
m_graph->addSeries(series);
@@ -159,7 +159,7 @@ void ScatterDataModifier::triggerSelection()
m_graph->scene()->setSelectionQueryPosition(m_inputHandler->inputPosition());
}
-void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq)
+void ScatterDataModifier::shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality sq)
{
int quality = int(sq);
emit shadowQualityChanged(quality); // connected to a checkbox in main.cpp
@@ -167,6 +167,6 @@ void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality s
void ScatterDataModifier::changeShadowQuality(int quality)
{
- QDataVis::ShadowQuality sq = QDataVis::ShadowQuality(quality);
+ QAbstract3DGraph::ShadowQuality sq = QAbstract3DGraph::ShadowQuality(quality);
m_graph->setShadowQuality(sq);
}
diff --git a/examples/custominput/scatterdatamodifier.h b/examples/custominput/scatterdatamodifier.h
index fc0bc789..9ea6a5c8 100644
--- a/examples/custominput/scatterdatamodifier.h
+++ b/examples/custominput/scatterdatamodifier.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -43,7 +43,7 @@ public:
public slots:
void changeShadowQuality(int quality);
- void shadowQualityUpdatedByVisual(QDataVis::ShadowQuality shadowQuality);
+ void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality);
void triggerSelection();
signals:
diff --git a/examples/customproxy/doc/images/customproxy-example.png b/examples/customproxy/doc/images/customproxy-example.png
index 3dc65bbb..753b8951 100644
--- a/examples/customproxy/doc/images/customproxy-example.png
+++ b/examples/customproxy/doc/images/customproxy-example.png
Binary files differ
diff --git a/examples/customproxy/doc/src/customproxy.qdoc b/examples/customproxy/doc/src/customproxy.qdoc
index dacedb80..8b506583 100644
--- a/examples/customproxy/doc/src/customproxy.qdoc
+++ b/examples/customproxy/doc/src/customproxy.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/main.cpp b/examples/customproxy/main.cpp
index 58b43873..dd74721e 100644
--- a/examples/customproxy/main.cpp
+++ b/examples/customproxy/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/rainfallgraph.cpp b/examples/customproxy/rainfallgraph.cpp
index ad45d016..e2f04923 100644
--- a/examples/customproxy/rainfallgraph.cpp
+++ b/examples/customproxy/rainfallgraph.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,8 +17,8 @@
****************************************************************************/
#include "rainfallgraph.h"
-#include <QtDataVisualization/q3dcategoryaxis.h>
-#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/qcategory3daxis.h>
+#include <QtDataVisualization/qvalue3daxis.h>
#include <QtDataVisualization/q3dscene.h>
#include <QtDataVisualization/q3dcamera.h>
#include <QtDataVisualization/qbar3dseries.h>
@@ -66,20 +66,22 @@ RainfallGraph::RainfallGraph(Q3DBars *rainfall)
series->setMesh(QAbstract3DSeries::MeshCylinder);
// Set shadows to medium
- m_graph->setShadowQuality(QDataVis::ShadowQualityMedium);
+ m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualityMedium);
// Set selection mode to bar and column
- m_graph->setSelectionMode(QDataVis::SelectionItemAndColumn | QDataVis::SelectionSlice);
+ m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndColumn | QAbstract3DGraph::SelectionSlice);
// Set theme
- m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeArmyBlue));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeArmyBlue);
- // Set font to theme
- m_graph->theme()->setFont(QFont("Century Gothic", 30));
+ // Override font in theme
+ m_graph->activeTheme()->setFont(QFont("Century Gothic", 30));
+
+ // Override label background for theme
+ m_graph->activeTheme()->setLabelBackgroundEnabled(false);
// Set camera position and zoom
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetIsometricRightHigh);
- m_graph->scene()->activeCamera()->setZoomLevel(75);
// Set window title
m_graph->setTitle(QStringLiteral("Monthly rainfall in Northern Finland"));
diff --git a/examples/customproxy/rainfallgraph.h b/examples/customproxy/rainfallgraph.h
index 6317ab71..6116eb9b 100644
--- a/examples/customproxy/rainfallgraph.h
+++ b/examples/customproxy/rainfallgraph.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/variantbardatamapping.cpp b/examples/customproxy/variantbardatamapping.cpp
index 0c2f146c..c8369b6e 100644
--- a/examples/customproxy/variantbardatamapping.cpp
+++ b/examples/customproxy/variantbardatamapping.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/variantbardatamapping.h b/examples/customproxy/variantbardatamapping.h
index 9ccf1610..3a145d9a 100644
--- a/examples/customproxy/variantbardatamapping.h
+++ b/examples/customproxy/variantbardatamapping.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,11 +19,8 @@
#ifndef VARIANTBARDATAMAPPING_H
#define VARIANTBARDATAMAPPING_H
-#include "qdatavisualizationenums.h"
#include <QStringList>
-using namespace QtDataVisualization;
-
class VariantBarDataMapping : public QObject
{
Q_OBJECT
diff --git a/examples/customproxy/variantbardataproxy.cpp b/examples/customproxy/variantbardataproxy.cpp
index 2997810f..cf1e1f90 100644
--- a/examples/customproxy/variantbardataproxy.cpp
+++ b/examples/customproxy/variantbardataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/variantbardataproxy.h b/examples/customproxy/variantbardataproxy.h
index 6f6ba763..b83f8a71 100644
--- a/examples/customproxy/variantbardataproxy.h
+++ b/examples/customproxy/variantbardataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/variantdataset.cpp b/examples/customproxy/variantdataset.cpp
index f73d83f8..3576aaab 100644
--- a/examples/customproxy/variantdataset.cpp
+++ b/examples/customproxy/variantdataset.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/customproxy/variantdataset.h b/examples/customproxy/variantdataset.h
index 6beb852f..f5eb5863 100644
--- a/examples/customproxy/variantdataset.h
+++ b/examples/customproxy/variantdataset.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,12 +19,9 @@
#ifndef VARIANTDATASET_H
#define VARIANTDATASET_H
-#include "qdatavisualizationenums.h"
#include <QScopedPointer>
#include <QVariantList>
-using namespace QtDataVisualization;
-
//! [1]
typedef QVariantList VariantDataItem;
typedef QList<VariantDataItem *> VariantDataItemList;
diff --git a/examples/examples.pri b/examples/examples.pri
index ca91aad0..046d6cd1 100644
--- a/examples/examples.pri
+++ b/examples/examples.pri
@@ -19,10 +19,17 @@ TEMPLATE = app
QT += datavisualization
+!static:android {
+ # Add Qt library to be loaded in shared android build
+ vis_lib_name = DataVisualization
+ vis_src_lib = lib$${vis_lib_name}.so
+ vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib
+ ANDROID_EXTRA_LIBS = $$vis_lib_dir
+}
+
contains(TARGET, qml.*) {
uri = QtDataVisualization
lib_name = datavisualizationqml2
- vis_lib_name = DataVisualization
uri_replaced = $$replace(uri, \\., $$QMAKE_DIR_SEP)
make_qmldir_path = $$DESTDIR/$$uri_replaced
@@ -37,32 +44,53 @@ contains(TARGET, qml.*) {
QMAKE_EXTRA_TARGETS += copy_qmldir
PRE_TARGETDEPS += $$copy_qmldir.target
+ static:contains(QT_CONFIG, static) {
+ # Make import scan find our copied qmldir & statically built qml lib
+ !win32 {
+ LIB_EXTENSION = a
+ } else {
+ LIB_EXTENSION = lib
+ }
+ QMLPATHS += $$DESTDIR
+ # We need to copy the qmldir & lib already at qmake run stage as import scan is done then
+ exists($$copy_qmldir.depends): system($$QMAKE_COPY $$copy_qmldir_formatted)
+ } else {
+ win32 {
+ LIB_EXTENSION = dll
+ } else {
+ mac|ios {
+ LIB_EXTENSION = dylib
+ } else {
+ LIB_EXTENSION = so
+ }
+ }
+ }
+
win32 {
CONFIG(debug, release|debug) {
- src_dir = debug
- src_lib = $${lib_name}d.dll
+ src_dir = /debug
+ src_lib = $${lib_name}d.$$LIB_EXTENSION
}
CONFIG(release, release|debug){
- src_dir = release
- src_lib = $${lib_name}.dll
+ src_dir = /release
+ src_lib = $${lib_name}.$$LIB_EXTENSION
}
} else {
- src_dir = .
- mac {
+ src_dir =
+ mac|ios {
CONFIG(debug, release|debug) {
- src_lib = lib$${lib_name}_debug.dylib
+ src_lib = lib$${lib_name}_debug.$$LIB_EXTENSION
}
CONFIG(release, release|debug){
- src_lib = lib$${lib_name}.dylib
+ src_lib = lib$${lib_name}.$$LIB_EXTENSION
}
} else {
# linux, android
- src_lib = lib$${lib_name}.so
- vis_src_lib = lib$${vis_lib_name}.so
+ src_lib = lib$${lib_name}.$$LIB_EXTENSION
}
}
copy_lib.target = $$make_qmldir_path/$$src_lib
- copy_lib.depends = $$OUT_PWD/../../src/$$lib_name/$$src_dir/$$src_lib
+ copy_lib.depends = $$OUT_PWD/../../src/$$lib_name$$src_dir/$$src_lib
copy_lib_formatted = \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\"
copy_lib.commands = $(COPY_FILE) $$copy_lib_formatted
QMAKE_EXTRA_TARGETS += copy_lib
@@ -70,14 +98,14 @@ contains(TARGET, qml.*) {
android {
system($$QMAKE_COPY $$copy_qmldir_formatted)
- system($$QMAKE_COPY $$copy_lib_formatted)
android_qmldir.files = $$copy_qmldir.target
android_qmldir.path = /assets/qml/$$uri_replaced
+ INSTALLS += android_qmldir
+ }
+ android|ios {
+ system($$QMAKE_COPY $$copy_lib_formatted)
android_qmlplugin.files = $$copy_lib.target
android_qmlplugin.path = $$target.path
- vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib
- vis_lib_formatted = $$replace(vis_lib_dir, /, $$QMAKE_DIR_SEP)
- ANDROID_EXTRA_LIBS = $$vis_lib_formatted
- INSTALLS += android_qmldir android_qmlplugin
+ INSTALLS += android_qmlplugin
}
}
diff --git a/examples/examples.pro b/examples/examples.pro
index d126b26d..4dd3edef 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -2,8 +2,11 @@ TEMPLATE = subdirs
SUBDIRS += qmlbars \
qmlscatter \
qmlsurface \
- qmlcustominput
-!android: {
+ qmlcustominput \
+ qmllegend \
+ qmlmultigraph
+
+!android:!ios {
SUBDIRS += bars \
custominput \
customproxy \
diff --git a/examples/itemmodel/doc/images/itemmodel-example-2.png b/examples/itemmodel/doc/images/itemmodel-example-2.png
index f8a0535a..677b7eec 100644
--- a/examples/itemmodel/doc/images/itemmodel-example-2.png
+++ b/examples/itemmodel/doc/images/itemmodel-example-2.png
Binary files differ
diff --git a/examples/itemmodel/doc/images/itemmodel-example.png b/examples/itemmodel/doc/images/itemmodel-example.png
index 68a4d970..c042f84d 100644
--- a/examples/itemmodel/doc/images/itemmodel-example.png
+++ b/examples/itemmodel/doc/images/itemmodel-example.png
Binary files differ
diff --git a/examples/itemmodel/doc/src/itemmodel.qdoc b/examples/itemmodel/doc/src/itemmodel.qdoc
index 6812c374..16cd1974 100644
--- a/examples/itemmodel/doc/src/itemmodel.qdoc
+++ b/examples/itemmodel/doc/src/itemmodel.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -88,8 +88,8 @@
means there will be a gap of 20% of the bar's thickness between the bars in both directions.
We want to be able to select rows of data for a closer inspection, so we set the selection mode
- to slice row. This means that whenever we select a bar in the graph, the whole row will be
- displayed separately.
+ to slice item and row. This means that whenever we select a bar in the graph, the whole row will be
+ displayed separately and the selected bar will be highlighted.
We don't want to use the default colors, so we set one of the predefined themes as the active theme.
diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp
index 46aa8bb8..b6b67f85 100644
--- a/examples/itemmodel/main.cpp
+++ b/examples/itemmodel/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,9 +17,9 @@
****************************************************************************/
#include <QtDataVisualization/q3dbars.h>
-#include <QtDataVisualization/q3dcategoryaxis.h>
+#include <QtDataVisualization/qcategory3daxis.h>
#include <QtDataVisualization/qitemmodelbardataproxy.h>
-#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/qvalue3daxis.h>
#include <QtDataVisualization/q3dscene.h>
#include <QtDataVisualization/q3dcamera.h>
#include <QtDataVisualization/qbar3dseries.h>
@@ -84,22 +84,23 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid
#ifndef USE_STATIC_DATA
// Set up sample space; make it as deep as it's wide
- m_graph->setDataWindow(m_rowCount, m_columnCount);
+ m_graph->rowAxis()->setRange(0, m_rowCount);
+ m_graph->columnAxis()->setRange(0, m_columnCount);
m_tableWidget->setColumnCount(m_columnCount);
// Set selection mode to full
- m_graph->setSelectionMode(QDataVis::SelectionItemRowAndColumn);
+ m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemRowAndColumn);
// Hide axis labels by explicitly setting one empty string as label list
- m_graph->rowAxis()->setCategoryLabels(QStringList(QString()));
- m_graph->columnAxis()->setCategoryLabels(QStringList(QString()));
+ m_graph->rowAxis()->setLabels(QStringList(QString()));
+ m_graph->columnAxis()->setLabels(QStringList(QString()));
- m_graph->activeDataProxy()->setItemLabelFormat(QStringLiteral("@valueLabel"));
+ m_graph->seriesList().at(0)->setItemLabelFormat(QStringLiteral("@valueLabel"));
#else
//! [6]
// Set selection mode to slice row
- m_graph->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice);
+ m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndRow | QAbstract3DGraph::SelectionSlice);
//! [6]
#endif
@@ -107,10 +108,10 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid
//! [7]
// Set theme
- m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
// Set font
- m_graph->theme()->setFont(QFont("Impact", 20));
+ m_graph->activeTheme()->setFont(QFont("Impact", 20));
// Set preset camera position
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront);
diff --git a/examples/qmlbars/doc/images/qmlbars-example.png b/examples/qmlbars/doc/images/qmlbars-example.png
index 00fb4a4f..64ad6b0e 100644
--- a/examples/qmlbars/doc/images/qmlbars-example.png
+++ b/examples/qmlbars/doc/images/qmlbars-example.png
Binary files differ
diff --git a/examples/qmlbars/doc/src/qmlbars.qdoc b/examples/qmlbars/doc/src/qmlbars.qdoc
index d56253d0..ecd8055a 100644
--- a/examples/qmlbars/doc/src/qmlbars.qdoc
+++ b/examples/qmlbars/doc/src/qmlbars.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlbars/main.cpp b/examples/qmlbars/main.cpp
index 889e2fa4..001c5625 100644
--- a/examples/qmlbars/main.cpp
+++ b/examples/qmlbars/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,6 +16,7 @@
**
****************************************************************************/
+#include <QtDataVisualization/qutils.h>
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#ifdef Q_OS_ANDROID
@@ -30,15 +31,8 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
-#if !defined(QT_OPENGL_ES_2)
// Enable antialiasing
- QSurfaceFormat surfaceFormat;
- surfaceFormat.setDepthBufferSize(24);
- surfaceFormat.setSamples(8);
- surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
- surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- viewer.setFormat(surfaceFormat);
-#endif
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
diff --git a/examples/qmlbars/qml/qmlbars/axes.qml b/examples/qmlbars/qml/qmlbars/axes.qml
index f5eb8d26..29979e1b 100644
--- a/examples/qmlbars/qml/qmlbars/axes.qml
+++ b/examples/qmlbars/qml/qmlbars/axes.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlbars/qml/qmlbars/data.qml b/examples/qmlbars/qml/qmlbars/data.qml
index 5a17bcd1..7e0978c6 100644
--- a/examples/qmlbars/qml/qmlbars/data.qml
+++ b/examples/qmlbars/qml/qmlbars/data.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,7 +17,6 @@
****************************************************************************/
import QtQuick 2.1
-import QtDataVisualization 1.0
Item {
property alias model: dataModel
diff --git a/examples/qmlbars/qml/qmlbars/main.qml b/examples/qmlbars/qml/qmlbars/main.qml
index 0581f834..0ff060ca 100644
--- a/examples/qmlbars/qml/qmlbars/main.qml
+++ b/examples/qmlbars/qml/qmlbars/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -43,7 +43,7 @@ Item {
selectedSeries: barSeries
function handleSelectionChange(series, position) {
- if (position != series.invalidSelectionPosition()) {
+ if (position != series.invalidSelectionPosition) {
selectedSeries = series
}
@@ -76,7 +76,7 @@ Item {
anchors.bottom: mainview.bottom
Bars3D {
- id: testGraph
+ id: barGraph
width: dataView.width
height: dataView.height
shadowQuality: AbstractGraph3D.ShadowQualityMedium
@@ -189,7 +189,7 @@ Item {
clip: true
//! [1]
onClicked: {
- if (testGraph.rowAxis.max !== 6) {
+ if (barGraph.rowAxis.max !== 6) {
text = "Show 2010 - 2012"
modelProxy.autoRowCategories = true
secondaryProxy.autoRowCategories = true
@@ -213,11 +213,11 @@ Item {
text: "Hide Shadows"
clip: true
onClicked: {
- if (testGraph.shadowQuality == AbstractGraph3D.ShadowQualityNone) {
- testGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium;
+ if (barGraph.shadowQuality == AbstractGraph3D.ShadowQualityNone) {
+ barGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium;
text = "Hide Shadows"
} else {
- testGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone;
+ barGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone;
text = "Show Shadows"
}
}
@@ -233,17 +233,17 @@ Item {
onClicked: {
if (!secondarySeries.visible) {
text = "Show Both"
- testGraph.valueAxis = graphAxes.expenses
+ barGraph.valueAxis = graphAxes.expenses
barSeries.visible = false
secondarySeries.visible = true
} else if (!barSeries.visible){
barSeries.visible = true
text = "Show Income"
- testGraph.valueAxis = graphAxes.income
+ barGraph.valueAxis = graphAxes.income
} else {
secondarySeries.visible = false
text = "Show Expenses"
- testGraph.valueAxis = graphAxes.income
+ barGraph.valueAxis = graphAxes.income
}
}
//! [0]
diff --git a/examples/qmlcustominput/doc/images/qmlcustominput-example.png b/examples/qmlcustominput/doc/images/qmlcustominput-example.png
index 436f4da5..1de740ea 100644
--- a/examples/qmlcustominput/doc/images/qmlcustominput-example.png
+++ b/examples/qmlcustominput/doc/images/qmlcustominput-example.png
Binary files differ
diff --git a/examples/qmlcustominput/doc/src/qmlcustominput.qdoc b/examples/qmlcustominput/doc/src/qmlcustominput.qdoc
index 14943aa0..7702dadf 100644
--- a/examples/qmlcustominput/doc/src/qmlcustominput.qdoc
+++ b/examples/qmlcustominput/doc/src/qmlcustominput.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlcustominput/main.cpp b/examples/qmlcustominput/main.cpp
index 8724e511..fcdd0035 100644
--- a/examples/qmlcustominput/main.cpp
+++ b/examples/qmlcustominput/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,6 +16,7 @@
**
****************************************************************************/
+#include <QtDataVisualization/qutils.h>
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#ifdef Q_OS_ANDROID
@@ -30,15 +31,8 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
-#if !defined(QT_OPENGL_ES_2)
// Enable antialiasing
- QSurfaceFormat surfaceFormat;
- surfaceFormat.setDepthBufferSize(24);
- surfaceFormat.setSamples(8);
- surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
- surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- viewer.setFormat(surfaceFormat);
-#endif
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
diff --git a/examples/qmlcustominput/qml/qmlcustominput/data.qml b/examples/qmlcustominput/qml/qmlcustominput/data.qml
index 1de07998..201247f1 100644
--- a/examples/qmlcustominput/qml/qmlcustominput/data.qml
+++ b/examples/qmlcustominput/qml/qmlcustominput/data.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,7 +17,6 @@
****************************************************************************/
import QtQuick 2.1
-import QtDataVisualization 1.0
Item {
property alias model: dataModel
diff --git a/examples/qmlcustominput/qml/qmlcustominput/main.qml b/examples/qmlcustominput/qml/qmlcustominput/main.qml
index 54ec3342..cfac0f15 100644
--- a/examples/qmlcustominput/qml/qmlcustominput/main.qml
+++ b/examples/qmlcustominput/qml/qmlcustominput/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlcustominput/qml/qmlcustominput/newbutton.qml b/examples/qmlcustominput/qml/qmlcustominput/newbutton.qml
index e44c9d1a..e4fb99d2 100644
--- a/examples/qmlcustominput/qml/qmlcustominput/newbutton.qml
+++ b/examples/qmlcustominput/qml/qmlcustominput/newbutton.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmllegend/doc/images/qmllegend-example.png b/examples/qmllegend/doc/images/qmllegend-example.png
new file mode 100644
index 00000000..ee546077
--- /dev/null
+++ b/examples/qmllegend/doc/images/qmllegend-example.png
Binary files differ
diff --git a/examples/qmllegend/doc/src/qmllegend.qdoc b/examples/qmllegend/doc/src/qmllegend.qdoc
new file mode 100644
index 00000000..14bacf06
--- /dev/null
+++ b/examples/qmllegend/doc/src/qmllegend.qdoc
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \example qmllegend
+ \title Qt Quick 2 Legend Example
+ \ingroup qtdatavisualization_examples
+ \brief Showing graph legend in a QML application.
+
+ The Qt Quick 2 legend example shows how to make an interactive legend for a graph.
+
+ \image qmllegend-example.png
+
+ The interesting thing about this example is displaying the legend. We'll concentrate on
+ that and skip explaining the basic functionality - for
+ more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
+
+ \section1 Legend
+
+ The legend is simply a column of custom \c LegendItem items inside a transparent rectangle.
+ Each item is supplied with a series and the graph theme:
+
+ \snippet ../examples/qmllegend/qml/qmllegend/main.qml 0
+
+ The legend items consist of a marker rectangle, which indicates the color of the series,
+ and a text field, which shows the name of the series. The colors we get from the series and
+ the theme supplied at legend item initialization:
+
+ \snippet ../examples/qmllegend/qml/qmllegend/legenditem.qml 0
+ \dots 4
+ \snippet ../examples/qmllegend/qml/qmllegend/legenditem.qml 1
+
+ We want the legend to be interactive, so we add additional logic to enable selection of a
+ series by clicking on a legend item, as well as highlighting the legend item corresponding
+ to the selected series.
+
+ The highlight depends on the selection state of the series, so we define two states, which
+ follow the Bar3DSeries::selectedBar property and adjust the \c legendItem color appropriately:
+
+ \snippet ../examples/qmllegend/qml/qmllegend/legenditem.qml 3
+
+ To make the legend item interactive, we define a MouseArea to detect clicks on it and adjust
+ the series selection accordingly:
+
+ \snippet ../examples/qmllegend/qml/qmllegend/legenditem.qml 2
+
+ The \c previousSelection used above is another custom property of \c LegendItem, which we update
+ whenever selection changes on the series. This way we remember the last selected bar of
+ each series:
+
+ \snippet ../examples/qmllegend/qml/qmllegend/legenditem.qml 4
+*/
diff --git a/examples/qmllegend/main.cpp b/examples/qmllegend/main.cpp
new file mode 100644
index 00000000..954affe4
--- /dev/null
+++ b/examples/qmllegend/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include <QtDataVisualization/qutils.h>
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+#ifdef Q_OS_ANDROID
+#include <QDir>
+#include <QQmlEngine>
+#endif
+#include <QDebug>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+
+ // Enable antialiasing
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
+
+#ifdef Q_OS_ANDROID
+ viewer.addImportPath(QString::fromLatin1("assets:/qml"));
+ viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
+ QString::fromLatin1("lib")));
+#endif
+ viewer.setTitle(QStringLiteral("Legend example"));
+
+ viewer.setSource(QUrl("qrc:/qml/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/qmllegend/qml/qmllegend/data.qml b/examples/qmllegend/qml/qmllegend/data.qml
new file mode 100644
index 00000000..4681c61c
--- /dev/null
+++ b/examples/qmllegend/qml/qmllegend/data.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ property alias model: dataModel
+
+ ListModel {
+ id: dataModel
+ ListElement{ year: "2010"; month: "Jan"; s1: "-14"; s2: "-15"; s3: "-15" }
+ ListElement{ year: "2010"; month: "Feb"; s1: "-15"; s2: "-16"; s3: "-9" }
+ ListElement{ year: "2010"; month: "Mar"; s1: "-7"; s2: "-4"; s3: "-2" }
+ ListElement{ year: "2010"; month: "Apr"; s1: "3"; s2: "2"; s3: "2" }
+ ListElement{ year: "2010"; month: "May"; s1: "7"; s2: "9"; s3: "10" }
+ ListElement{ year: "2010"; month: "Jun"; s1: "12"; s2: "13"; s3: "22" }
+ ListElement{ year: "2010"; month: "Jul"; s1: "18"; s2: "19"; s3: "24" }
+ ListElement{ year: "2010"; month: "Aug"; s1: "15"; s2: "13"; s3: "16" }
+ ListElement{ year: "2010"; month: "Sep"; s1: "6"; s2: "3"; s3: "4" }
+ ListElement{ year: "2010"; month: "Oct"; s1: "1"; s2: "2"; s3: "-2" }
+ ListElement{ year: "2010"; month: "Nov"; s1: "-2"; s2: "-5"; s3: "-6" }
+ ListElement{ year: "2010"; month: "Dec"; s1: "-3"; s2: "-3"; s3: "-9" }
+
+ ListElement{ year: "2011"; month: "Jan"; s1: "-12"; s2: "-11"; s3: "-14" }
+ ListElement{ year: "2011"; month: "Feb"; s1: "-13"; s2: "-12"; s3: "-10" }
+ ListElement{ year: "2011"; month: "Mar"; s1: "-6"; s2: "-4"; s3: "-3" }
+ ListElement{ year: "2011"; month: "Apr"; s1: "0"; s2: "1"; s3: "3" }
+ ListElement{ year: "2011"; month: "May"; s1: "4"; s2: "12"; s3: "11" }
+ ListElement{ year: "2011"; month: "Jun"; s1: "9"; s2: "17"; s3: "23" }
+ ListElement{ year: "2011"; month: "Jul"; s1: "15"; s2: "22"; s3: "25" }
+ ListElement{ year: "2011"; month: "Aug"; s1: "12"; s2: "15"; s3: "12" }
+ ListElement{ year: "2011"; month: "Sep"; s1: "2"; s2: "4"; s3: "7" }
+ ListElement{ year: "2011"; month: "Oct"; s1: "-2"; s2: "4"; s3: "-4" }
+ ListElement{ year: "2011"; month: "Nov"; s1: "-4"; s2: "-8"; s3: "-5" }
+ ListElement{ year: "2011"; month: "Dec"; s1: "-6"; s2: "-6"; s3: "-7" }
+
+ ListElement{ year: "2012"; month: "Jan"; s1: "-10"; s2: "-19"; s3: "-11" }
+ ListElement{ year: "2012"; month: "Feb"; s1: "-11"; s2: "-17"; s3: "-4" }
+ ListElement{ year: "2012"; month: "Mar"; s1: "-6"; s2: "-3"; s3: "-1" }
+ ListElement{ year: "2012"; month: "Apr"; s1: "5"; s2: "1"; s3: "2" }
+ ListElement{ year: "2012"; month: "May"; s1: "9"; s2: "12"; s3: "13" }
+ ListElement{ year: "2012"; month: "Jun"; s1: "11"; s2: "16"; s3: "26" }
+ ListElement{ year: "2012"; month: "Jul"; s1: "18"; s2: "20"; s3: "23" }
+ ListElement{ year: "2012"; month: "Aug"; s1: "19"; s2: "12"; s3: "12" }
+ ListElement{ year: "2012"; month: "Sep"; s1: "9"; s2: "1"; s3: "3" }
+ ListElement{ year: "2012"; month: "Oct"; s1: "-3"; s2: "2"; s3: "-1" }
+ ListElement{ year: "2012"; month: "Nov"; s1: "-5"; s2: "-4"; s3: "-3" }
+ ListElement{ year: "2012"; month: "Dec"; s1: "-7"; s2: "-2"; s3: "-4" }
+
+ ListElement{ year: "2013"; month: "Jan"; s1: "-18"; s2: "-19"; s3: "-19" }
+ ListElement{ year: "2013"; month: "Feb"; s1: "-17"; s2: "-19"; s3: "-12" }
+ ListElement{ year: "2013"; month: "Mar"; s1: "-9"; s2: "-6"; s3: "-5" }
+ ListElement{ year: "2013"; month: "Apr"; s1: "0"; s2: "0"; s3: "0" }
+ ListElement{ year: "2013"; month: "May"; s1: "4"; s2: "7"; s3: "9" }
+ ListElement{ year: "2013"; month: "Jun"; s1: "9"; s2: "11"; s3: "18" }
+ ListElement{ year: "2013"; month: "Jul"; s1: "13"; s2: "15"; s3: "20" }
+ ListElement{ year: "2013"; month: "Aug"; s1: "10"; s2: "11"; s3: "13" }
+ ListElement{ year: "2013"; month: "Sep"; s1: "3"; s2: "1"; s3: "2" }
+ ListElement{ year: "2013"; month: "Oct"; s1: "0"; s2: "1"; s3: "-4" }
+ ListElement{ year: "2013"; month: "Nov"; s1: "-5"; s2: "-6"; s3: "-5" }
+ ListElement{ year: "2013"; month: "Dec"; s1: "-6"; s2: "-7"; s3: "-10" }
+ }
+}
diff --git a/examples/qmllegend/qml/qmllegend/legenditem.qml b/examples/qmllegend/qml/qmllegend/legenditem.qml
new file mode 100644
index 00000000..50be7a8d
--- /dev/null
+++ b/examples/qmllegend/qml/qmllegend/legenditem.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Layouts 1.0
+import QtQuick.Window 2.1
+import QtDataVisualization 1.0
+
+Rectangle {
+ //! [0]
+ property Theme3D theme
+ property Bar3DSeries series
+ //! [0]
+ property point previousSelection
+
+ id: legendItem
+ state: "unselected"
+
+ //! [1]
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ clip: true
+ Item {
+ id: markerSpace
+ Layout.minimumWidth: 20
+ Layout.minimumHeight: 20
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignVCenter
+ Rectangle {
+ x: parent.x + parent.width / 4
+ y: parent.y + parent.height / 4
+ width: parent.width / 2
+ height: width
+ border.color: "black"
+ color: series.baseColor
+ }
+ }
+ Item {
+ height: markerSpace.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignVCenter
+ Layout.minimumWidth: 100
+ Text {
+ anchors.fill: parent
+ text: series.name
+ verticalAlignment: Text.AlignVCenter
+ clip: true
+ color: theme.labelTextColor
+ font: theme.font
+ }
+ }
+ }
+ //! [1]
+
+ //! [2]
+ MouseArea {
+ id: mouseArea
+ anchors.fill: legendItem
+ onClicked: {
+ if (legendItem.state === "selected") {
+ series.selectedBar = series.invalidSelectionPosition
+ } else {
+ series.selectedBar = previousSelection
+ }
+ }
+ }
+ //! [2]
+
+ //! [4]
+ Connections {
+ target: series
+ onSelectedBarChanged: {
+ if (position != series.invalidSelectionPosition) {
+ previousSelection = position
+ }
+ }
+ }
+ //! [4]
+
+ //! [3]
+ states: [
+ State {
+ name: "selected"
+ when: series.selectedBar != series.invalidSelectionPosition
+ PropertyChanges {
+ target: legendItem
+ color: series.singleHighlightColor
+ }
+ },
+ State {
+ name: "unselected"
+ when: series.selectedBar == series.invalidSelectionPosition
+ PropertyChanges {
+ target: legendItem
+ color: theme.labelBackgroundColor
+ }
+ }
+ ]
+ //! [3]
+}
diff --git a/examples/qmllegend/qml/qmllegend/main.qml b/examples/qmllegend/qml/qmllegend/main.qml
new file mode 100644
index 00000000..6c488d6a
--- /dev/null
+++ b/examples/qmllegend/qml/qmllegend/main.qml
@@ -0,0 +1,239 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
+import QtDataVisualization 1.0
+import "."
+
+Item {
+ id: mainView
+ width: 800
+ height: 600
+
+ property int buttonLayoutHeight: 180;
+
+ Data {
+ id: graphData
+ }
+
+ Theme3D {
+ id: firstTheme
+ type: Theme3D.ThemeQt
+ }
+
+ Theme3D {
+ id: secondTheme
+ type: Theme3D.ThemeEbony
+ }
+
+ Item {
+ id: dataView
+ anchors.top: buttonLayout.bottom
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Bars3D {
+ id: barGraph
+ anchors.fill: parent
+ selectionMode: AbstractGraph3D.SelectionItemAndRow
+ scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh
+ theme: firstTheme
+ valueAxis.labelFormat: "%d\u00B0C"
+
+ Bar3DSeries {
+ id: station1
+ name: "Station 1"
+ itemLabelFormat: "Temperature at @seriesName for @colLabel, @rowLabel: @valueLabel"
+
+ ItemModelBarDataProxy {
+ itemModel: graphData.model
+ rowRole: "year"
+ columnRole: "month"
+ valueRole: "s1"
+ }
+ }
+ Bar3DSeries {
+ id: station2
+ name: "Station 2"
+ itemLabelFormat: "Temperature at @seriesName for @colLabel, @rowLabel: @valueLabel"
+
+ ItemModelBarDataProxy {
+ itemModel: graphData.model
+ rowRole: "year"
+ columnRole: "month"
+ valueRole: "s2"
+ }
+ }
+ Bar3DSeries {
+ id: station3
+ name: "Station 3"
+ itemLabelFormat: "Temperature at @seriesName for @colLabel, @rowLabel: @valueLabel"
+
+ ItemModelBarDataProxy {
+ itemModel: graphData.model
+ rowRole: "year"
+ columnRole: "month"
+ valueRole: "s2"
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ property int legendLocation: 3
+
+ id: legendPanel
+ width: 200
+ height: 100
+ border.color: barGraph.theme.labelTextColor
+ border.width: 2
+ color: "#00000000" // Transparent
+
+ //! [0]
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: parent.border.width
+ spacing: 0
+ clip: true
+ LegendItem {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ series: station1
+ theme: barGraph.theme
+ onColorChanged: legendPanel.relayout()
+ }
+ LegendItem {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ series: station2
+ theme: barGraph.theme
+ onColorChanged: legendPanel.relayout()
+ }
+ LegendItem {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ series: station3
+ theme: barGraph.theme
+ onColorChanged: legendPanel.relayout()
+ }
+ }
+ //! [0]
+
+ function relayout() {
+ // Workaround for a layout bug that causes transparent colors to use black background
+ // instead of what is actually under the items if just the color changes.
+ // Forcing a relayout by adjusting layout's available area fixes the background.
+ var originalWidth = border.width
+ border.width = originalWidth + 1
+ border.width = originalWidth
+ }
+
+ states: [
+ State {
+ name: "topleft"
+ when: legendPanel.legendLocation === 1
+ AnchorChanges {
+ target: legendPanel
+ anchors.top: dataView.top
+ anchors.bottom: undefined
+ anchors.left: dataView.left
+ anchors.right: undefined
+ }
+ },
+ State {
+ name: "topright"
+ when: legendPanel.legendLocation === 2
+ AnchorChanges {
+ target: legendPanel
+ anchors.top: dataView.top
+ anchors.bottom: undefined
+ anchors.left: undefined
+ anchors.right: dataView.right
+ }
+ },
+ State {
+ name: "bottomleft"
+ when: legendPanel.legendLocation === 3
+ AnchorChanges {
+ target: legendPanel
+ anchors.top: undefined
+ anchors.bottom: dataView.bottom
+ anchors.left: dataView.left
+ anchors.right: undefined
+ }
+ },
+ State {
+ name: "bottomright"
+ when: legendPanel.legendLocation === 4
+ AnchorChanges {
+ target: legendPanel
+ anchors.top: undefined
+ anchors.bottom: dataView.bottom
+ anchors.left: undefined
+ anchors.right: dataView.right
+ }
+ }
+ ]
+ }
+
+ RowLayout {
+ id: buttonLayout
+ Layout.minimumHeight: themeToggle.height
+ width: parent.width
+ anchors.left: parent.left
+ spacing: 0
+
+ NewButton {
+ id: themeToggle
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ text: "Change Theme"
+ onClicked: {
+ if (barGraph.theme === firstTheme) {
+ barGraph.theme = secondTheme
+ } else {
+ barGraph.theme = firstTheme
+ }
+ }
+ }
+ NewButton {
+ id: repositionLegend
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ text: "Reposition Legend"
+ onClicked: {
+ if (legendPanel.legendLocation === 4) {
+ legendPanel.legendLocation = 1
+ } else {
+ legendPanel.legendLocation++
+ }
+ }
+ }
+ NewButton {
+ id: exitButton
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ text: "Quit"
+ onClicked: Qt.quit(0);
+ }
+ }
+
+}
diff --git a/examples/qmllegend/qml/qmllegend/newbutton.qml b/examples/qmllegend/qml/qmllegend/newbutton.qml
new file mode 100644
index 00000000..e4fb99d2
--- /dev/null
+++ b/examples/qmllegend/qml/qmllegend/newbutton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Styles 1.0
+
+Item {
+ id: newbutton
+
+ property alias text: buttonText.text
+
+ signal clicked
+
+ implicitWidth: buttonText.implicitWidth + 5
+ implicitHeight: buttonText.implicitHeight + 10
+
+ Button {
+ id: buttonText
+ width: parent.width
+ height: parent.height
+
+ style: ButtonStyle {
+ label: Component {
+ Text {
+ text: buttonText.text
+ clip: true
+ wrapMode: Text.WordWrap
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ anchors.fill: parent
+ }
+ }
+ }
+ onClicked: newbutton.clicked()
+ }
+}
diff --git a/examples/qmllegend/qmllegend.desktop b/examples/qmllegend/qmllegend.desktop
new file mode 100644
index 00000000..6ad68edd
--- /dev/null
+++ b/examples/qmllegend/qmllegend.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=qmllegend
+Exec=/opt/qmllegend/bin/qmllegend
+Icon=qmllegend64
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/qmllegend/qmllegend.pro b/examples/qmllegend/qmllegend.pro
new file mode 100644
index 00000000..d896e7ac
--- /dev/null
+++ b/examples/qmllegend/qmllegend.pro
@@ -0,0 +1,25 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+QT += widgets
+
+# Add more folders to ship with the application, here
+folder_01.source = qml/qmllegend
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+
+# Additional import path used to resolve QML modules in Creator's code model
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
+qtcAddDeployment()
+
+RESOURCES += qmllegend.qrc
+
+OTHER_FILES += doc/src/* \
+ doc/images/*
diff --git a/examples/qmllegend/qmllegend.qrc b/examples/qmllegend/qmllegend.qrc
new file mode 100644
index 00000000..6496cfdb
--- /dev/null
+++ b/examples/qmllegend/qmllegend.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file alias="Data.qml">qml/qmllegend/data.qml</file>
+ <file alias="main.qml">qml/qmllegend/main.qml</file>
+ <file alias="LegendItem.qml">qml/qmllegend/legenditem.qml</file>
+ <file alias="NewButton.qml">qml/qmllegend/newbutton.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/qmllegend/qmllegend64.png b/examples/qmllegend/qmllegend64.png
new file mode 100644
index 00000000..707d5c4e
--- /dev/null
+++ b/examples/qmllegend/qmllegend64.png
Binary files differ
diff --git a/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.cpp
new file mode 100644
index 00000000..10709d7a
--- /dev/null
+++ b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.cpp
@@ -0,0 +1,81 @@
+// checksum 0x4f6f version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#include "qtquick2applicationviewer.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+class QtQuick2ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ friend class QtQuick2ApplicationViewer;
+ static QString adjustPath(const QString &path);
+};
+
+QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#if defined(Q_OS_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
+ : QQuickView(parent)
+ , d(new QtQuick2ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QQuickView::SizeRootObjectToView);
+}
+
+QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+#ifdef Q_OS_ANDROID
+ setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
+#else
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+}
+
+void QtQuick2ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.h b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.h
new file mode 100644
index 00000000..cf66f140
--- /dev/null
+++ b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.h
@@ -0,0 +1,33 @@
+// checksum 0xfde6 version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#ifndef QTQUICK2APPLICATIONVIEWER_H
+#define QTQUICK2APPLICATIONVIEWER_H
+
+#include <QtQuick/QQuickView>
+
+class QtQuick2ApplicationViewer : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
+ virtual ~QtQuick2ApplicationViewer();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+
+ void showExpanded();
+
+private:
+ class QtQuick2ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.pri b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.pri
new file mode 100644
index 00000000..e5f7990f
--- /dev/null
+++ b/examples/qmllegend/qtquick2applicationviewer/qtquick2applicationviewer.pri
@@ -0,0 +1,180 @@
+# checksum 0x7b0d version 0x90005
+# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+# The code below adds the QtQuick2ApplicationViewer to the project and handles
+# the activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += qml quick
+
+SOURCES += $$PWD/qtquick2applicationviewer.cpp
+HEADERS += $$PWD/qtquick2applicationviewer.h
+INCLUDEPATH += $$PWD
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Android and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ itemsources = $${item}.files
+ } else {
+ itemsources = $${item}.sources
+ }
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+android-no-sdk {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ target.path = /data/user/qt
+
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /assets/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+
+ export(target.path)
+ INSTALLS += target
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ !isEmpty(target.path) {
+ installPrefix = $${target.path}
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ isEmpty(target.path) {
+ target.path = $${installPrefix}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
diff --git a/examples/qmlmultigraph/doc/images/qmlmultigraph-example.png b/examples/qmlmultigraph/doc/images/qmlmultigraph-example.png
new file mode 100644
index 00000000..d4e524e2
--- /dev/null
+++ b/examples/qmlmultigraph/doc/images/qmlmultigraph-example.png
Binary files differ
diff --git a/examples/qmlmultigraph/doc/src/qmlmultigraph.qdoc b/examples/qmlmultigraph/doc/src/qmlmultigraph.qdoc
new file mode 100644
index 00000000..f3ba172d
--- /dev/null
+++ b/examples/qmlmultigraph/doc/src/qmlmultigraph.qdoc
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \example qmlmultigraph
+ \title Qt Quick 2 Multiple Graphs Example
+ \ingroup qtdatavisualization_examples
+ \brief Showing multiple graphs simultaneously in a QML application.
+
+ The Qt Quick 2 multiple graphs example demonstrates using multiple graphs in single window.
+
+ \image qmlmultigraph-example.png
+
+ The interesting thing about this example is demonstrating that multiple graphs can be used
+ simultaneously, so most functionality is not explained in detail.
+ For more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
+
+ \section1 Multiple Graphs
+
+ Using multiple graphs in a single application doesn't require anything special, simply define
+ and position the graphs as normal. In this example the graphs are shown side by side in a RowLayout:
+
+ \snippet ../examples/qmlmultigraph/qml/qmlmultigraph/main.qml 0
+
+ Each graph has a parent Rectangle item to provide it with a border. The color of the rectangle is set
+ to fully transparent, because otherwise the rectangles would hide the graphs, which are always drawn behind
+ all other QML elements.
+*/
diff --git a/examples/qmlmultigraph/main.cpp b/examples/qmlmultigraph/main.cpp
new file mode 100644
index 00000000..25cd5d9c
--- /dev/null
+++ b/examples/qmlmultigraph/main.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include <QtDataVisualization/qutils.h>
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+#ifdef Q_OS_ANDROID
+#include <QDir>
+#include <QQmlEngine>
+#endif
+#include <QDebug>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+
+ // Enable antialiasing
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
+
+#ifdef Q_OS_ANDROID
+ viewer.addImportPath(QString::fromLatin1("assets:/qml"));
+ viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
+ QString::fromLatin1("lib")));
+#endif
+ viewer.setTitle(QStringLiteral("QML multigraph example"));
+ viewer.setSource(QUrl("qrc:/qml/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/data.qml b/examples/qmlmultigraph/qml/qmlmultigraph/data.qml
new file mode 100644
index 00000000..679cb067
--- /dev/null
+++ b/examples/qmlmultigraph/qml/qmlmultigraph/data.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ property alias barData: barDataModel
+ property alias scatterData: scatterDataModel
+ property alias surfaceData: surfaceDataModel
+
+ ListModel {
+ id: barDataModel
+ ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; income: "8300"; }
+ ListElement{ year: "2012"; city: "Kemi"; expenses: "2100"; income: "6500"; }
+ ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; income: "7500"; }
+ ListElement{ year: "2012"; city: "Tampere"; expenses: "4330"; income: "5800"; }
+ ListElement{ year: "2013"; city: "Oulu"; expenses: "3960"; income: "9000"; }
+ ListElement{ year: "2013"; city: "Kemi"; expenses: "1990"; income: "3000"; }
+ ListElement{ year: "2013"; city: "Helsinki"; expenses: "7230"; income: "9900"; }
+ ListElement{ year: "2013"; city: "Tampere"; expenses: "4650"; income: "7600"; }
+ }
+
+ ListModel {
+ id: scatterDataModel
+ ListElement{ xPos: "2.754"; yPos: "1.000"; zPos: "3.362"; }
+ ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; }
+ ListElement{ xPos: "4.564"; yPos: "1.865"; zPos: "1.000"; }
+ ListElement{ xPos: "1.000"; yPos: "1.224"; zPos: "2.983"; }
+ ListElement{ xPos: "2.323"; yPos: "2.502"; zPos: "3.133"; }
+ ListElement{ xPos: "3.663"; yPos: "3.186"; zPos: "2.843"; }
+ ListElement{ xPos: "4.190"; yPos: "4.875"; zPos: "3.942"; }
+ ListElement{ xPos: "3.569"; yPos: "3.685"; zPos: "1.456"; }
+ ListElement{ xPos: "5.000"; yPos: "5.000"; zPos: "4.678"; }
+ ListElement{ xPos: "4.349"; yPos: "3.850"; zPos: "5.000"; }
+ }
+
+ ListModel {
+ id: surfaceDataModel
+ ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; }
+ ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; }
+ ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; }
+ ListElement{ longitude: "23"; latitude: "10"; pop_density: "2.53"; }
+ ListElement{ longitude: "20"; latitude: "11"; pop_density: "3.55"; }
+ ListElement{ longitude: "21"; latitude: "11"; pop_density: "3.03"; }
+ ListElement{ longitude: "22"; latitude: "11"; pop_density: "3.46"; }
+ ListElement{ longitude: "23"; latitude: "11"; pop_density: "4.12"; }
+ ListElement{ longitude: "20"; latitude: "12"; pop_density: "3.37"; }
+ ListElement{ longitude: "21"; latitude: "12"; pop_density: "2.98"; }
+ ListElement{ longitude: "22"; latitude: "12"; pop_density: "3.33"; }
+ ListElement{ longitude: "23"; latitude: "12"; pop_density: "3.23"; }
+ ListElement{ longitude: "20"; latitude: "13"; pop_density: "5.34"; }
+ ListElement{ longitude: "21"; latitude: "13"; pop_density: "4.54"; }
+ ListElement{ longitude: "22"; latitude: "13"; pop_density: "4.65"; }
+ ListElement{ longitude: "23"; latitude: "13"; pop_density: "6.67"; }
+ ListElement{ longitude: "20"; latitude: "14"; pop_density: "6.01"; }
+ ListElement{ longitude: "21"; latitude: "14"; pop_density: "5.83"; }
+ ListElement{ longitude: "22"; latitude: "14"; pop_density: "5.90"; }
+ ListElement{ longitude: "23"; latitude: "14"; pop_density: "7.32"; }
+ }
+}
+
diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/main.qml b/examples/qmlmultigraph/qml/qmlmultigraph/main.qml
new file mode 100644
index 00000000..bc2f7fe3
--- /dev/null
+++ b/examples/qmlmultigraph/qml/qmlmultigraph/main.qml
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Layouts 1.0
+import QtDataVisualization 1.0
+import "."
+
+Item {
+ id: mainView
+ width: 1280
+ height: 400
+
+ Data {
+ id: data
+ }
+
+ //! [0]
+ RowLayout {
+ id: graphLayout
+ spacing: 1
+ anchors.top: buttonLayout.bottom
+ anchors.bottom: mainView.bottom
+ anchors.left: mainView.left
+ anchors.right: mainView.right
+
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ border.color: surfaceGraph.theme.gridLineColor
+ border.width: 2
+ color: "#00000000" // Transparent
+
+ Surface3D {
+ id: surfaceGraph
+ anchors.fill: parent
+ anchors.margins: parent.border.width
+ theme: Theme3D { type: Theme3D.ThemePrimaryColors }
+ scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh
+
+ Surface3DSeries {
+ itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel"
+ ItemModelSurfaceDataProxy {
+ itemModel: data.surfaceData
+ // Mapping model roles to surface series rows, columns, and values.
+ rowRole: "longitude"
+ columnRole: "latitude"
+ valueRole: "pop_density"
+ }
+ }
+ }
+ }
+
+
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ border.color: scatterGraph.theme.gridLineColor
+ border.width: 2
+ color: "#00000000" // Transparent
+
+ Scatter3D {
+ id: scatterGraph
+ anchors.fill: parent
+ anchors.margins: parent.border.width
+ theme: Theme3D { type: Theme3D.ThemeDigia }
+ scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh
+
+ Scatter3DSeries {
+ ItemModelScatterDataProxy {
+ itemModel: data.scatterData
+ // Mapping model roles to scatter series item coordinates.
+ xPosRole: "xPos"
+ yPosRole: "yPos"
+ zPosRole: "zPos"
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ border.color: barGraph.theme.gridLineColor
+ border.width: 2
+ color: "#00000000" // Transparent
+
+ Bars3D {
+ id: barGraph
+ anchors.fill: parent
+ anchors.margins: parent.border.width
+ theme: Theme3D { type: Theme3D.ThemeQt }
+ selectionMode: AbstractGraph3D.SelectionItemAndRow | AbstractGraph3D.SelectionSlice
+ scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh
+
+ Bar3DSeries {
+ itemLabelFormat: "@seriesName for @colLabel, @rowLabel: @valueLabel"
+ name: "Yearly expenses"
+
+ ItemModelBarDataProxy {
+ itemModel: data.barData
+ // Mapping model roles to bar series rows, columns, and values.
+ rowRole: "year"
+ columnRole: "city"
+ valueRole: "expenses"
+ }
+ }
+
+ Bar3DSeries {
+ itemLabelFormat: "@seriesName for @colLabel, @rowLabel: @valueLabel"
+ name: "Yearly income"
+
+ ItemModelBarDataProxy {
+ itemModel: data.barData
+ // Mapping model roles to bar series rows, columns, and values.
+ rowRole: "year"
+ columnRole: "city"
+ valueRole: "income"
+ }
+ }
+ }
+ }
+ }
+ //! [0]
+
+ RowLayout {
+ id: buttonLayout
+ Layout.minimumHeight: exitButton.height
+ width: parent.width
+ anchors.left: parent.left
+ anchors.top: parent.top
+ spacing: 0
+
+ NewButton {
+ id: clearSelectionsButton
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ text: "Clear Selections"
+ onClicked: {
+ barGraph.clearSelection()
+ scatterGraph.clearSelection()
+ surfaceGraph.clearSelection()
+ }
+ }
+
+ NewButton {
+ id: exitButton
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ text: "Quit"
+ onClicked: Qt.quit(0);
+ }
+ }
+}
diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml b/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml
new file mode 100644
index 00000000..e4fb99d2
--- /dev/null
+++ b/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Styles 1.0
+
+Item {
+ id: newbutton
+
+ property alias text: buttonText.text
+
+ signal clicked
+
+ implicitWidth: buttonText.implicitWidth + 5
+ implicitHeight: buttonText.implicitHeight + 10
+
+ Button {
+ id: buttonText
+ width: parent.width
+ height: parent.height
+
+ style: ButtonStyle {
+ label: Component {
+ Text {
+ text: buttonText.text
+ clip: true
+ wrapMode: Text.WordWrap
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ anchors.fill: parent
+ }
+ }
+ }
+ onClicked: newbutton.clicked()
+ }
+}
diff --git a/examples/qmlmultigraph/qmlmultigraph.desktop b/examples/qmlmultigraph/qmlmultigraph.desktop
new file mode 100644
index 00000000..90b16a4e
--- /dev/null
+++ b/examples/qmlmultigraph/qmlmultigraph.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=qmlmultigraph
+Exec=/opt/qmlmultigraph/bin/qmlmultigraph
+Icon=qmlmultigraph64
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/qmlmultigraph/qmlmultigraph.pro b/examples/qmlmultigraph/qmlmultigraph.pro
new file mode 100644
index 00000000..af4e0d90
--- /dev/null
+++ b/examples/qmlmultigraph/qmlmultigraph.pro
@@ -0,0 +1,25 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+QT += widgets
+
+# Add more folders to ship with the application, here
+folder_01.source = qml/qmlmultigraph
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+
+# Additional import path used to resolve QML modules in Creator's code model
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
+qtcAddDeployment()
+
+RESOURCES += qmlmultigraph.qrc
+
+OTHER_FILES += doc/src/* \
+ doc/images/*
diff --git a/examples/qmlmultigraph/qmlmultigraph.qrc b/examples/qmlmultigraph/qmlmultigraph.qrc
new file mode 100644
index 00000000..02e0c682
--- /dev/null
+++ b/examples/qmlmultigraph/qmlmultigraph.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file alias="main.qml">qml/qmlmultigraph/main.qml</file>
+ <file alias="NewButton.qml">qml/qmlmultigraph/newbutton.qml</file>
+ <file alias="Data.qml">qml/qmlmultigraph/data.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/qmlmultigraph/qmlmultigraph64.png b/examples/qmlmultigraph/qmlmultigraph64.png
new file mode 100644
index 00000000..707d5c4e
--- /dev/null
+++ b/examples/qmlmultigraph/qmlmultigraph64.png
Binary files differ
diff --git a/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.cpp
new file mode 100644
index 00000000..10709d7a
--- /dev/null
+++ b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.cpp
@@ -0,0 +1,81 @@
+// checksum 0x4f6f version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#include "qtquick2applicationviewer.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+class QtQuick2ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ friend class QtQuick2ApplicationViewer;
+ static QString adjustPath(const QString &path);
+};
+
+QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#if defined(Q_OS_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
+ : QQuickView(parent)
+ , d(new QtQuick2ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QQuickView::SizeRootObjectToView);
+}
+
+QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+#ifdef Q_OS_ANDROID
+ setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
+#else
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+}
+
+void QtQuick2ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.h b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.h
new file mode 100644
index 00000000..cf66f140
--- /dev/null
+++ b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.h
@@ -0,0 +1,33 @@
+// checksum 0xfde6 version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#ifndef QTQUICK2APPLICATIONVIEWER_H
+#define QTQUICK2APPLICATIONVIEWER_H
+
+#include <QtQuick/QQuickView>
+
+class QtQuick2ApplicationViewer : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
+ virtual ~QtQuick2ApplicationViewer();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+
+ void showExpanded();
+
+private:
+ class QtQuick2ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.pri b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.pri
new file mode 100644
index 00000000..e5f7990f
--- /dev/null
+++ b/examples/qmlmultigraph/qtquick2applicationviewer/qtquick2applicationviewer.pri
@@ -0,0 +1,180 @@
+# checksum 0x7b0d version 0x90005
+# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+# The code below adds the QtQuick2ApplicationViewer to the project and handles
+# the activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += qml quick
+
+SOURCES += $$PWD/qtquick2applicationviewer.cpp
+HEADERS += $$PWD/qtquick2applicationviewer.h
+INCLUDEPATH += $$PWD
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Android and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ itemsources = $${item}.files
+ } else {
+ itemsources = $${item}.sources
+ }
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+android-no-sdk {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ target.path = /data/user/qt
+
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /assets/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+
+ export(target.path)
+ INSTALLS += target
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ !isEmpty(target.path) {
+ installPrefix = $${target.path}
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ isEmpty(target.path) {
+ target.path = $${installPrefix}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
diff --git a/examples/qmlscatter/doc/images/qmlscatter-example.png b/examples/qmlscatter/doc/images/qmlscatter-example.png
index ff9df1fc..65ec4816 100644
--- a/examples/qmlscatter/doc/images/qmlscatter-example.png
+++ b/examples/qmlscatter/doc/images/qmlscatter-example.png
Binary files differ
diff --git a/examples/qmlscatter/doc/src/qmlscatter.qdoc b/examples/qmlscatter/doc/src/qmlscatter.qdoc
index 06719ffc..366b02ea 100644
--- a/examples/qmlscatter/doc/src/qmlscatter.qdoc
+++ b/examples/qmlscatter/doc/src/qmlscatter.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -46,8 +46,13 @@
\snippet ../examples/qmlscatter/main.cpp 0
- This will help us when deploying the application to Android. We'll also change the application
- to be shown maximized by replacing
+ This will help us when deploying the application to Android.
+
+ We'll enable anti-aliasing for our application in environments that support it:
+
+ \snippet ../examples/qmlscatter/main.cpp 2
+
+ We'll also change the application to be shown maximized by replacing
\code viewer.showExpanded(); \endcode
@@ -112,19 +117,22 @@
\snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 3
- We added a built-in Theme3D and changed the font in it. We also changed the shadow quality.
+ We added a customized theme and changed the shadow quality.
We're happy with the other visual properties, so we won't change them.
+ The custom theme is based on a predefined theme, but we change the font in it:
+
+ \snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 13
+
Then it's time to start feeding the graph some data.
\section1 Adding data to the graph
- Let's create a \c Data item inside the \c mainView and name it \c {seriesOneData}:
+ Let's create a \c Data item inside the \c mainView and name it \c seriesData:
\snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 4
- We'll add two more of these: \c seriesTwoData and \c seriesThreeData to add to the three series
- we're going to have. They are added similarly as \c {seriesOneData}.
+ The \c seriesData item contains the data models for all three series we use in this example.
This is the component that holds our data in \c {data.qml}. It has an \c Item as the main
component.
diff --git a/examples/qmlscatter/main.cpp b/examples/qmlscatter/main.cpp
index 159612e9..4ecefdc1 100644
--- a/examples/qmlscatter/main.cpp
+++ b/examples/qmlscatter/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,6 +16,7 @@
**
****************************************************************************/
+#include <QtDataVisualization/qutils.h>
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#ifdef Q_OS_ANDROID
@@ -30,15 +31,10 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
-#if !defined(QT_OPENGL_ES_2)
// Enable antialiasing
- QSurfaceFormat surfaceFormat;
- surfaceFormat.setDepthBufferSize(24);
- surfaceFormat.setSamples(8);
- surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
- surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- viewer.setFormat(surfaceFormat);
-#endif
+ //! [2]
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
+ //! [2]
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
diff --git a/examples/qmlscatter/qml/qmlscatter/data.qml b/examples/qmlscatter/qml/qmlscatter/data.qml
index bf4853df..23c4e5d5 100644
--- a/examples/qmlscatter/qml/qmlscatter/data.qml
+++ b/examples/qmlscatter/qml/qmlscatter/data.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,7 +17,6 @@
****************************************************************************/
import QtQuick 2.1
-import QtDataVisualization 1.0
Item {
//! [1]
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml
index 62727f84..beb4ccaa 100644
--- a/examples/qmlscatter/qml/qmlscatter/main.qml
+++ b/examples/qmlscatter/qml/qmlscatter/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -30,16 +30,22 @@ Item {
//! [4]
Data {
- id: seriesOneData
+ id: seriesData
}
//! [4]
- Data {
- id: seriesTwoData
+ //! [13]
+ Theme3D {
+ id: themeIsabelle
+ type: Theme3D.ThemeIsabelle
+ font.family: "Lucida Handwriting"
+ font.pointSize: 40
}
+ //! [13]
- Data {
- id: seriesThreeData
+ Theme3D {
+ id: themeArmyBlue
+ type: Theme3D.ThemeArmyBlue
}
//! [8]
@@ -59,11 +65,7 @@ Item {
height: dataView.height
//! [2]
//! [3]
- theme: Theme3D {
- type: Theme3D.ThemeIsabelle
- font.family: "Lucida Handwriting"
- font.pointSize: 40
- }
+ theme: themeIsabelle
shadowQuality: AbstractGraph3D.ShadowQualitySoftLow
//! [3]
//! [6]
@@ -87,7 +89,7 @@ Item {
//! [11]
ItemModelScatterDataProxy {
- itemModel: seriesOneData.model
+ itemModel: seriesData.model
xPosRole: "xPos"
yPosRole: "yPos"
zPosRole: "zPos"
@@ -104,7 +106,7 @@ Item {
//! [12]
ItemModelScatterDataProxy {
- itemModel: seriesTwoData.modelTwo
+ itemModel: seriesData.modelTwo
xPosRole: "xPos"
yPosRole: "yPos"
zPosRole: "zPos"
@@ -117,7 +119,7 @@ Item {
mesh: Abstract3DSeries.MeshMinimal
ItemModelScatterDataProxy {
- itemModel: seriesThreeData.modelThree
+ itemModel: seriesData.modelThree
xPosRole: "xPos"
yPosRole: "yPos"
zPosRole: "zPos"
@@ -188,14 +190,14 @@ Item {
text: "Change Theme"
onClicked: {
if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) {
- // Ownership of the theme is transferred and old theme is destroyed when setting
- // a new one, so we need to create them dynamically
- scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0;
- Theme3D {type: Theme3D.ThemeIsabelle; font.family: "Lucida Handwriting";
- font.pointSize: 40}', parent);
+ scatterGraph.theme = themeIsabelle
+ } else {
+ scatterGraph.theme = themeArmyBlue
+ }
+ if (scatterGraph.theme.backgroundEnabled === true) {
+ backgroundToggle.text = "Hide Background";
} else {
- scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0;
- Theme3D {type: Theme3D.ThemeArmyBlue}', parent);
+ backgroundToggle.text = "Show Background";
}
}
}
diff --git a/examples/qmlscatter/qml/qmlscatter/newbutton.qml b/examples/qmlscatter/qml/qmlscatter/newbutton.qml
index e44c9d1a..e4fb99d2 100644
--- a/examples/qmlscatter/qml/qmlscatter/newbutton.qml
+++ b/examples/qmlscatter/qml/qmlscatter/newbutton.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlsurface/doc/images/qmlsurface-example.png b/examples/qmlsurface/doc/images/qmlsurface-example.png
index 57b2633b..d8d394fa 100644
--- a/examples/qmlsurface/doc/images/qmlsurface-example.png
+++ b/examples/qmlsurface/doc/images/qmlsurface-example.png
Binary files differ
diff --git a/examples/qmlsurface/doc/src/qmlsurface.qdoc b/examples/qmlsurface/doc/src/qmlsurface.qdoc
index ffbdf305..78f9c745 100644
--- a/examples/qmlsurface/doc/src/qmlsurface.qdoc
+++ b/examples/qmlsurface/doc/src/qmlsurface.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlsurface/main.cpp b/examples/qmlsurface/main.cpp
index 21c987b3..03518d00 100644
--- a/examples/qmlsurface/main.cpp
+++ b/examples/qmlsurface/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,6 +16,7 @@
**
****************************************************************************/
+#include <QtDataVisualization/qutils.h>
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
@@ -30,15 +31,8 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
-#if !defined(QT_OPENGL_ES_2)
// Enable antialiasing
- QSurfaceFormat surfaceFormat;
- surfaceFormat.setDepthBufferSize(24);
- surfaceFormat.setSamples(8);
- surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
- surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- viewer.setFormat(surfaceFormat);
-#endif
+ viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
diff --git a/examples/qmlsurface/qml/qmlsurface/data.qml b/examples/qmlsurface/qml/qmlsurface/data.qml
index 8637c29c..5fd4ece8 100644
--- a/examples/qmlsurface/qml/qmlsurface/data.qml
+++ b/examples/qmlsurface/qml/qmlsurface/data.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,7 +17,6 @@
****************************************************************************/
import QtQuick 2.1
-import QtDataVisualization 1.0
Item {
property alias model: dataModel
diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml
index 9f37a3f5..da608aa7 100644
--- a/examples/qmlsurface/qml/qmlsurface/main.qml
+++ b/examples/qmlsurface/qml/qmlsurface/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/qmlsurface/qml/qmlsurface/newbutton.qml b/examples/qmlsurface/qml/qmlsurface/newbutton.qml
index e44c9d1a..e4fb99d2 100644
--- a/examples/qmlsurface/qml/qmlsurface/newbutton.qml
+++ b/examples/qmlsurface/qml/qmlsurface/newbutton.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/scatter/doc/images/scatter-example.png b/examples/scatter/doc/images/scatter-example.png
index d1a3c7d9..97a9ba78 100644
--- a/examples/scatter/doc/images/scatter-example.png
+++ b/examples/scatter/doc/images/scatter-example.png
Binary files differ
diff --git a/examples/scatter/doc/src/scatter.qdoc b/examples/scatter/doc/src/scatter.qdoc
index 9bef441c..31cfeb09 100644
--- a/examples/scatter/doc/src/scatter.qdoc
+++ b/examples/scatter/doc/src/scatter.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/scatter/main.cpp b/examples/scatter/main.cpp
index af95dd05..dc71667f 100644
--- a/examples/scatter/main.cpp
+++ b/examples/scatter/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/scatter/scatterdatamodifier.cpp b/examples/scatter/scatterdatamodifier.cpp
index 6cdb1458..db2426ce 100644
--- a/examples/scatter/scatterdatamodifier.cpp
+++ b/examples/scatter/scatterdatamodifier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "scatterdatamodifier.h"
#include <QtDataVisualization/qscatterdataproxy.h>
-#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/qvalue3daxis.h>
#include <QtDataVisualization/q3dscene.h>
#include <QtDataVisualization/q3dcamera.h>
#include <QtDataVisualization/qscatter3dseries.h>
@@ -39,24 +39,24 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
m_smooth(true)
{
//! [0]
- m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeEbony));
- QFont font = m_graph->theme()->font();
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
+ QFont font = m_graph->activeTheme()->font();
font.setPointSize(m_fontSize);
- m_graph->theme()->setFont(font);
- m_graph->setShadowQuality(QDataVis::ShadowQualitySoftLow);
+ m_graph->activeTheme()->setFont(font);
+ m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftLow);
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront);
//! [0]
//! [1]
- m_graph->setAxisX(new Q3DValueAxis);
- m_graph->setAxisY(new Q3DValueAxis);
- m_graph->setAxisZ(new Q3DValueAxis);
+ m_graph->setAxisX(new QValue3DAxis);
+ m_graph->setAxisY(new QValue3DAxis);
+ m_graph->setAxisZ(new QValue3DAxis);
//! [1]
//! [2]
QScatterDataProxy *proxy = new QScatterDataProxy;
QScatter3DSeries *series = new QScatter3DSeries(proxy);
- series->setItemLabelFormat("@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel");
+ series->setItemLabelFormat(QStringLiteral("@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel"));
series->setMeshSmooth(m_smooth);
m_graph->addSeries(series);
//! [2]
@@ -131,10 +131,11 @@ void ScatterDataModifier::setSmoothDots(int smooth)
void ScatterDataModifier::changeTheme(int theme)
{
- m_graph->setTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
- emit backgroundEnabledChanged(m_graph->theme()->isBackgroundEnabled());
- emit gridEnabledChanged(m_graph->theme()->isGridEnabled());
- emit fontChanged(m_graph->theme()->font());
+ Q3DTheme *currentTheme = m_graph->activeTheme();
+ currentTheme->setType(Q3DTheme::Theme(theme));
+ emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
+ emit gridEnabledChanged(currentTheme->isGridEnabled());
+ emit fontChanged(currentTheme->font());
}
void ScatterDataModifier::changePresetCamera()
@@ -149,17 +150,17 @@ void ScatterDataModifier::changePresetCamera()
void ScatterDataModifier::changeLabelStyle()
{
- m_graph->theme()->setLabelBackgroundEnabled(!m_graph->theme()->isLabelBackgroundEnabled());
+ m_graph->activeTheme()->setLabelBackgroundEnabled(!m_graph->activeTheme()->isLabelBackgroundEnabled());
}
void ScatterDataModifier::changeFont(const QFont &font)
{
QFont newFont = font;
newFont.setPointSizeF(m_fontSize);
- m_graph->theme()->setFont(newFont);
+ m_graph->activeTheme()->setFont(newFont);
}
-void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq)
+void ScatterDataModifier::shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality sq)
{
int quality = int(sq);
emit shadowQualityChanged(quality); // connected to a checkbox in main.cpp
@@ -167,18 +168,18 @@ void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality s
void ScatterDataModifier::changeShadowQuality(int quality)
{
- QDataVis::ShadowQuality sq = QDataVis::ShadowQuality(quality);
+ QAbstract3DGraph::ShadowQuality sq = QAbstract3DGraph::ShadowQuality(quality);
m_graph->setShadowQuality(sq);
}
void ScatterDataModifier::setBackgroundEnabled(int enabled)
{
- m_graph->theme()->setBackgroundEnabled((bool)enabled);
+ m_graph->activeTheme()->setBackgroundEnabled((bool)enabled);
}
void ScatterDataModifier::setGridEnabled(int enabled)
{
- m_graph->theme()->setGridEnabled((bool)enabled);
+ m_graph->activeTheme()->setGridEnabled((bool)enabled);
}
//! [8]
diff --git a/examples/scatter/scatterdatamodifier.h b/examples/scatter/scatterdatamodifier.h
index 78dd45e3..e22f24c7 100644
--- a/examples/scatter/scatterdatamodifier.h
+++ b/examples/scatter/scatterdatamodifier.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -47,7 +47,7 @@ public slots:
void changeStyle(int style);
void changeTheme(int theme);
void changeShadowQuality(int quality);
- void shadowQualityUpdatedByVisual(QDataVis::ShadowQuality shadowQuality);
+ void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality);
signals:
void backgroundEnabledChanged(bool enabled);
diff --git a/examples/surface/doc/images/surface-example.png b/examples/surface/doc/images/surface-example.png
index 77c1f900..c323df78 100644
--- a/examples/surface/doc/images/surface-example.png
+++ b/examples/surface/doc/images/surface-example.png
Binary files differ
diff --git a/examples/surface/doc/src/surface.qdoc b/examples/surface/doc/src/surface.qdoc
index 6f49a3dc..4b0ec63d 100644
--- a/examples/surface/doc/src/surface.qdoc
+++ b/examples/surface/doc/src/surface.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -124,7 +124,8 @@
Q3DSurface supports all the themes Qt Data Visualization has. The example has a pull
down menu for selecting the theme. The following method is connected to the
- menu to activate the selected theme.
+ menu to activate the selected theme. The theme type is changed to another predefined theme,
+ which overwrites all theme properties to predefined values:
\snippet ../examples/surface/surfacegraph.cpp 6
diff --git a/examples/surface/main.cpp b/examples/surface/main.cpp
index 313ddf6d..4e82eca8 100644
--- a/examples/surface/main.cpp
+++ b/examples/surface/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp
index 7ebb6b72..5dd64c1f 100644
--- a/examples/surface/surfacegraph.cpp
+++ b/examples/surface/surfacegraph.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "surfacegraph.h"
-#include <QtDataVisualization/Q3DValueAxis>
+#include <QtDataVisualization/QValue3DAxis>
#include <QtDataVisualization/Q3DTheme>
#include <QtGui/QImage>
#include <QtCore/qmath.h>
@@ -35,9 +35,9 @@ const float sampleMax = 8.0f;
SurfaceGraph::SurfaceGraph(Q3DSurface *surface)
: m_graph(surface)
{
- m_graph->setAxisX(new Q3DValueAxis);
- m_graph->setAxisY(new Q3DValueAxis);
- m_graph->setAxisZ(new Q3DValueAxis);
+ m_graph->setAxisX(new QValue3DAxis);
+ m_graph->setAxisY(new QValue3DAxis);
+ m_graph->setAxisZ(new QValue3DAxis);
//! [0]
m_sqrtSinProxy = new QSurfaceDataProxy();
@@ -229,7 +229,7 @@ void SurfaceGraph::setAxisZRange(float min, float max)
//! [6]
void SurfaceGraph::changeTheme(int theme)
{
- m_graph->setTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
+ m_graph->activeTheme()->setType(Q3DTheme::Theme(theme));
}
//! [6]
diff --git a/examples/surface/surfacegraph.h b/examples/surface/surfacegraph.h
index ecdec672..8047be11 100644
--- a/examples/surface/surfacegraph.h
+++ b/examples/surface/surfacegraph.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -38,12 +38,12 @@ public:
void enableSqrtSinModel(bool enable);
//! [0]
- void toggleModeNone() { m_graph->setSelectionMode(QDataVis::SelectionNone); }
- void toggleModeItem() { m_graph->setSelectionMode(QDataVis::SelectionItem); }
- void toggleModeSliceRow() { m_graph->setSelectionMode(QDataVis::SelectionItemAndRow
- | QDataVis::SelectionSlice); }
- void toggleModeSliceColumn() { m_graph->setSelectionMode(QDataVis::SelectionItemAndColumn
- | QDataVis::SelectionSlice); }
+ void toggleModeNone() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionNone); }
+ void toggleModeItem() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItem); }
+ void toggleModeSliceRow() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndRow
+ | QAbstract3DGraph::SelectionSlice); }
+ void toggleModeSliceColumn() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndColumn
+ | QAbstract3DGraph::SelectionSlice); }
//! [0]
void setBlackToYellowGradient();
diff --git a/src/datavisualization/axis/axis.pri b/src/datavisualization/axis/axis.pri
index 4e96618b..2c8bf70e 100644
--- a/src/datavisualization/axis/axis.pri
+++ b/src/datavisualization/axis/axis.pri
@@ -1,12 +1,12 @@
HEADERS += \
- $$PWD/q3dabstractaxis.h \
- $$PWD/q3dabstractaxis_p.h \
- $$PWD/q3dvalueaxis.h \
- $$PWD/q3dvalueaxis_p.h \
- $$PWD/q3dcategoryaxis.h \
- $$PWD/q3dcategoryaxis_p.h
+ $$PWD/qabstract3daxis.h \
+ $$PWD/qabstract3daxis_p.h \
+ $$PWD/qvalue3daxis.h \
+ $$PWD/qvalue3daxis_p.h \
+ $$PWD/qcategory3daxis.h \
+ $$PWD/qcategory3daxis_p.h
SOURCES += \
- $$PWD/q3dabstractaxis.cpp \
- $$PWD/q3dvalueaxis.cpp \
- $$PWD/q3dcategoryaxis.cpp
+ $$PWD/qabstract3daxis.cpp \
+ $$PWD/qvalue3daxis.cpp \
+ $$PWD/qcategory3daxis.cpp
diff --git a/src/datavisualization/axis/q3dabstractaxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp
index 0b284947..2ee7a25d 100644
--- a/src/datavisualization/axis/q3dabstractaxis.cpp
+++ b/src/datavisualization/axis/qabstract3daxis.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,20 +16,20 @@
**
****************************************************************************/
-#include "q3dabstractaxis.h"
-#include "q3dabstractaxis_p.h"
+#include "qabstract3daxis.h"
+#include "qabstract3daxis_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
- * \class Q3DAbstractAxis
+ * \class QAbstract3DAxis
* \inmodule QtDataVisualization
- * \brief Q3DAbstractAxis is base class for axes of a graph.
+ * \brief QAbstract3DAxis is base class for axes of a graph.
* \since Qt Data Visualization 1.0
*
* You should not need to use this class directly, but one of its subclasses instead.
*
- * \sa Q3DCategoryAxis, Q3DValueAxis
+ * \sa QCategory3DAxis, QValue3DAxis
*/
/*!
@@ -37,10 +37,12 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
* \ingroup datavisualization_qml
- * \instantiates Q3DAbstractAxis
+ * \instantiates QAbstract3DAxis
* \brief AbstractAxis3D is base type for axes of a graph.
*
* This type is uncreatable, but contains properties that are exposed via subtypes.
+ *
+ * For AbstractAxis3D enums, see \l QAbstract3DAxis::AxisOrientation and \l QAbstract3DAxis::AxisType
*/
/*!
@@ -88,7 +90,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
/*!
- * \enum Q3DAbstractAxis::AxisOrientation
+ * \enum QAbstract3DAxis::AxisOrientation
*
* The orientation of the axis object.
*
@@ -99,7 +101,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- * \enum Q3DAbstractAxis::AxisType
+ * \enum QAbstract3DAxis::AxisType
*
* The type of the axis object.
*
@@ -111,45 +113,45 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
/*!
* \internal
*/
-Q3DAbstractAxis::Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent) :
+QAbstract3DAxis::QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent) :
QObject(parent),
d_ptr(d)
{
}
/*!
- * Destroys Q3DAbstractAxis.
+ * Destroys QAbstract3DAxis.
*/
-Q3DAbstractAxis::~Q3DAbstractAxis()
+QAbstract3DAxis::~QAbstract3DAxis()
{
}
/*!
- * \property Q3DAbstractAxis::orientation
+ * \property QAbstract3DAxis::orientation
*
- * Defines the orientation of the axis, one of \c Q3DAbstractAxis::AxisOrientation.
+ * Defines the orientation of the axis, one of \c QAbstract3DAxis::AxisOrientation.
*/
-Q3DAbstractAxis::AxisOrientation Q3DAbstractAxis::orientation() const
+QAbstract3DAxis::AxisOrientation QAbstract3DAxis::orientation() const
{
return d_ptr->m_orientation;
}
/*!
- * \property Q3DAbstractAxis::type
+ * \property QAbstract3DAxis::type
*
- * Defines the type of the axis, one of \c Q3DAbstractAxis::AxisType.
+ * Defines the type of the axis, one of \c QAbstract3DAxis::AxisType.
*/
-Q3DAbstractAxis::AxisType Q3DAbstractAxis::type() const
+QAbstract3DAxis::AxisType QAbstract3DAxis::type() const
{
return d_ptr->m_type;
}
/*!
- * \property Q3DAbstractAxis::title
+ * \property QAbstract3DAxis::title
*
* Defines the title for the axis.
*/
-void Q3DAbstractAxis::setTitle(QString title)
+void QAbstract3DAxis::setTitle(QString title)
{
if (d_ptr->m_title != title) {
d_ptr->m_title = title;
@@ -157,23 +159,23 @@ void Q3DAbstractAxis::setTitle(QString title)
}
}
-QString Q3DAbstractAxis::title() const
+QString QAbstract3DAxis::title() const
{
return d_ptr->m_title;
}
/*!
- * \property Q3DAbstractAxis::labels
+ * \property QAbstract3DAxis::labels
*
* Defines the labels for the axis.
- * \note Setting this property for Q3DValueAxis does nothing, as it generates labels automatically.
+ * \note Setting this property for QValue3DAxis does nothing, as it generates labels automatically.
*/
-void Q3DAbstractAxis::setLabels(const QStringList &labels)
+void QAbstract3DAxis::setLabels(const QStringList &labels)
{
Q_UNUSED(labels)
}
-QStringList Q3DAbstractAxis::labels() const
+QStringList QAbstract3DAxis::labels() const
{
d_ptr->updateLabels();
return d_ptr->m_labels;
@@ -182,60 +184,60 @@ QStringList Q3DAbstractAxis::labels() const
/*!
* Sets value range of the axis from \a min to \a max.
* When setting the range, the max is adjusted if necessary, to ensure that the range remains valid.
- * \note For Q3DCategoryAxis this specifies the index range of rows or columns to show.
+ * \note For QCategory3DAxis this specifies the index range of rows or columns to show.
*/
-void Q3DAbstractAxis::setRange(float min, float max)
+void QAbstract3DAxis::setRange(float min, float max)
{
d_ptr->setRange(min, max);
setAutoAdjustRange(false);
}
/*!
- * \property Q3DAbstractAxis::min
+ * \property QAbstract3DAxis::min
*
* Defines the minimum value on the axis.
* When setting this property the max is adjusted if necessary, to ensure that the range remains
* valid.
- * \note For Q3DCategoryAxis this specifies the index of the first row or column to show.
+ * \note For QCategory3DAxis this specifies the index of the first row or column to show.
*/
-void Q3DAbstractAxis::setMin(float min)
+void QAbstract3DAxis::setMin(float min)
{
d_ptr->setMin(min);
setAutoAdjustRange(false);
}
/*!
- * \property Q3DAbstractAxis::max
+ * \property QAbstract3DAxis::max
*
* Defines the maximum value on the axis.
* When setting this property the min is adjusted if necessary, to ensure that the range remains
* valid.
- * \note For Q3DCategoryAxis this specifies the index of the last row or column to show.
+ * \note For QCategory3DAxis this specifies the index of the last row or column to show.
*/
-void Q3DAbstractAxis::setMax(float max)
+void QAbstract3DAxis::setMax(float max)
{
d_ptr->setMax(max);
setAutoAdjustRange(false);
}
-float Q3DAbstractAxis::min() const
+float QAbstract3DAxis::min() const
{
return d_ptr->m_min;
}
-float Q3DAbstractAxis::max() const
+float QAbstract3DAxis::max() const
{
return d_ptr->m_max;
}
/*!
- * \property Q3DAbstractAxis::autoAdjustRange
+ * \property QAbstract3DAxis::autoAdjustRange
*
* If set, the axis will automatically adjust the range so that all data fits in it.
*
* \sa setRange(), setMin(), setMax()
*/
-void Q3DAbstractAxis::setAutoAdjustRange(bool autoAdjust)
+void QAbstract3DAxis::setAutoAdjustRange(bool autoAdjust)
{
if (d_ptr->m_autoAdjust != autoAdjust) {
d_ptr->m_autoAdjust = autoAdjust;
@@ -243,23 +245,22 @@ void Q3DAbstractAxis::setAutoAdjustRange(bool autoAdjust)
}
}
-bool Q3DAbstractAxis::isAutoAdjustRange() const
+bool QAbstract3DAxis::isAutoAdjustRange() const
{
return d_ptr->m_autoAdjust;
}
/*!
- * \fn Q3DAbstractAxis::rangeChanged(float min, float max)
+ * \fn QAbstract3DAxis::rangeChanged(float min, float max)
*
* Emits range \a min and \a max values when range changes.
*/
-// Q3DAbstractAxisPrivate
-
-Q3DAbstractAxisPrivate::Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type)
+// QAbstract3DAxisPrivate
+QAbstract3DAxisPrivate::QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type)
: QObject(0),
q_ptr(q),
- m_orientation(Q3DAbstractAxis::AxisOrientationNone),
+ m_orientation(QAbstract3DAxis::AxisOrientationNone),
m_type(type),
m_isDefaultAxis(false),
m_min(0.0f),
@@ -270,13 +271,13 @@ Q3DAbstractAxisPrivate::Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAx
{
}
-Q3DAbstractAxisPrivate::~Q3DAbstractAxisPrivate()
+QAbstract3DAxisPrivate::~QAbstract3DAxisPrivate()
{
}
-void Q3DAbstractAxisPrivate::setOrientation(Q3DAbstractAxis::AxisOrientation orientation)
+void QAbstract3DAxisPrivate::setOrientation(QAbstract3DAxis::AxisOrientation orientation)
{
- if (m_orientation == Q3DAbstractAxis::AxisOrientationNone) {
+ if (m_orientation == QAbstract3DAxis::AxisOrientationNone) {
m_orientation = orientation;
emit q_ptr->orientationChanged(orientation);
} else {
@@ -284,12 +285,12 @@ void Q3DAbstractAxisPrivate::setOrientation(Q3DAbstractAxis::AxisOrientation ori
}
}
-void Q3DAbstractAxisPrivate::updateLabels()
+void QAbstract3DAxisPrivate::updateLabels()
{
// Default implementation does nothing
}
-void Q3DAbstractAxisPrivate::setRange(float min, float max)
+void QAbstract3DAxisPrivate::setRange(float min, float max)
{
bool adjusted = false;
if (m_onlyPositiveValues) {
@@ -336,7 +337,7 @@ void Q3DAbstractAxisPrivate::setRange(float min, float max)
emit q_ptr->maxChanged(m_max);
}
-void Q3DAbstractAxisPrivate::setMin(float min)
+void QAbstract3DAxisPrivate::setMin(float min)
{
if (m_onlyPositiveValues) {
if (min < 0.0f) {
@@ -365,7 +366,7 @@ void Q3DAbstractAxisPrivate::setMin(float min)
}
}
-void Q3DAbstractAxisPrivate::setMax(float max)
+void QAbstract3DAxisPrivate::setMax(float max)
{
if (m_onlyPositiveValues) {
if (max < 0.0f) {
@@ -401,4 +402,4 @@ void Q3DAbstractAxisPrivate::setMax(float max)
}
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/axis/q3dabstractaxis.h b/src/datavisualization/axis/qabstract3daxis.h
index 825290f5..28b93f36 100644
--- a/src/datavisualization/axis/q3dabstractaxis.h
+++ b/src/datavisualization/axis/qabstract3daxis.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,20 +16,21 @@
**
****************************************************************************/
-#ifndef Q3DABSTRACTAXIS_H
-#define Q3DABSTRACTAXIS_H
+#ifndef QABSTRACT3DAXIS_H
+#define QABSTRACT3DAXIS_H
+
+#include <QtDataVisualization/qdatavisualizationglobal.h>
-#include <QtDataVisualization/qdatavisualizationenums.h>
#include <QObject>
#include <QScopedPointer>
#include <QVector>
#include <QStringList>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DAbstractAxisPrivate;
+class QAbstract3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DAbstractAxis : public QObject
+class QT_DATAVISUALIZATION_EXPORT QAbstract3DAxis : public QObject
{
Q_OBJECT
Q_ENUMS(AxisOrientation)
@@ -54,14 +55,13 @@ public:
AxisTypeNone = 0,
AxisTypeCategory = 1,
AxisTypeValue = 2
- //AxisTypeLogValue = 6 // inherits valueaxis (4 + 2) // TODO
};
protected:
- explicit Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent = 0);
+ explicit QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent = 0);
public:
- virtual ~Q3DAbstractAxis();
+ virtual ~QAbstract3DAxis();
void setTitle(QString title);
QString title() const;
@@ -93,15 +93,15 @@ signals:
void autoAdjustRangeChanged(bool autoAdjust);
protected:
- QScopedPointer<Q3DAbstractAxisPrivate> d_ptr;
+ QScopedPointer<QAbstract3DAxisPrivate> d_ptr;
private:
- Q_DISABLE_COPY(Q3DAbstractAxis)
+ Q_DISABLE_COPY(QAbstract3DAxis)
friend class Abstract3DController;
friend class Bars3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QABSTRACTAXIS_H
+#endif
diff --git a/src/datavisualization/axis/q3dabstractaxis_p.h b/src/datavisualization/axis/qabstract3daxis_p.h
index 3293e41e..4eb8de68 100644
--- a/src/datavisualization/axis/q3dabstractaxis_p.h
+++ b/src/datavisualization/axis/qabstract3daxis_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -27,22 +27,22 @@
// We mean it.
#include "datavisualizationglobal_p.h"
-#include "q3dabstractaxis.h"
+#include "qabstract3daxis.h"
#include "abstract3dcontroller_p.h"
-#ifndef Q3DABSTRACTAXIS_P_H
-#define Q3DABSTRACTAXIS_P_H
+#ifndef QABSTRACT3DAXIS_P_H
+#define QABSTRACT3DAXIS_P_H
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DAbstractAxisPrivate : public QObject
+class QAbstract3DAxisPrivate : public QObject
{
Q_OBJECT
public:
- Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type);
- virtual ~Q3DAbstractAxisPrivate();
+ QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type);
+ virtual ~QAbstract3DAxisPrivate();
- void setOrientation(Q3DAbstractAxis::AxisOrientation orientation);
+ void setOrientation(QAbstract3DAxis::AxisOrientation orientation);
inline bool isDefaultAxis() { return m_isDefaultAxis; }
inline void setDefaultAxis(bool isDefault) { m_isDefaultAxis = isDefault; }
@@ -54,12 +54,12 @@ public:
protected:
virtual void updateLabels();
- Q3DAbstractAxis *q_ptr;
+ QAbstract3DAxis *q_ptr;
QString m_title;
QStringList m_labels;
- Q3DAbstractAxis::AxisOrientation m_orientation;
- Q3DAbstractAxis::AxisType m_type;
+ QAbstract3DAxis::AxisOrientation m_orientation;
+ QAbstract3DAxis::AxisType m_type;
bool m_isDefaultAxis;
float m_min;
float m_max;
@@ -67,11 +67,11 @@ protected:
bool m_onlyPositiveValues;
bool m_allowMinMaxSame;
- friend class Q3DAbstractAxis;
- friend class Q3DValueAxis;
- friend class Q3DCategoryAxis;
+ friend class QAbstract3DAxis;
+ friend class QValue3DAxis;
+ friend class QCategory3DAxis;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QABSTRACTAXIS_P_H
+#endif
diff --git a/src/datavisualization/axis/q3dcategoryaxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp
index 26a75f93..c1d5777a 100644
--- a/src/datavisualization/axis/q3dcategoryaxis.cpp
+++ b/src/datavisualization/axis/qcategory3daxis.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,20 +16,20 @@
**
****************************************************************************/
-#include "q3dcategoryaxis.h"
-#include "q3dcategoryaxis_p.h"
+#include "qcategory3daxis.h"
+#include "qcategory3daxis_p.h"
#include "bars3dcontroller_p.h"
#include "qbardataproxy.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
- * \class Q3DCategoryAxis
+ * \class QCategory3DAxis
* \inmodule QtDataVisualization
- * \brief The Q3DCategoryAxis class is used for manipulating an axis of a graph.
+ * \brief The QCategory3DAxis class is used for manipulating an axis of a graph.
* \since Qt Data Visualization 1.0
*
- * Q3DCategoryAxis provides an axis that can be given labels. The axis is divided into equal-sized
+ * QCategory3DAxis provides an axis that can be given labels. The axis is divided into equal-sized
* categories based on the data window size defined by setting the axis range.
*
* Grid lines are drawn between categories, if visible. Labels are drawn to positions of categories
@@ -41,7 +41,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
* \ingroup datavisualization_qml
- * \instantiates Q3DCategoryAxis
+ * \instantiates QCategory3DAxis
* \inherits AbstractAxis3D
* \brief The CategoryAxis3D type is used for manipulating an axis of a graph.
*
@@ -53,44 +53,38 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*
* Defines labels for axis applied to categories. If there are fewer labels than categories, the
* remaining ones do not have a label. If category labels are not defined explicitly, labels are
- * generated from the data row (or column) labels.
- *
- * \note If the graph has multiple visible series and category labels are not defined explicitly,
- * changing the rows (or columns) on any of the attached series will regenerate the labels.
+ * generated from the data row (or column) labels of the primary series of the graph.
*/
/*!
- * Constructs Q3DCategoryAxis with \a parent.
+ * Constructs QCategory3DAxis with \a parent.
*/
-Q3DCategoryAxis::Q3DCategoryAxis(QObject *parent) :
- Q3DAbstractAxis(new Q3DCategoryAxisPrivate(this), parent)
+QCategory3DAxis::QCategory3DAxis(QObject *parent) :
+ QAbstract3DAxis(new QCategory3DAxisPrivate(this), parent)
{
- connect(this, &Q3DCategoryAxis::labelsChanged, this, &Q3DAbstractAxis::labelsChanged);
+ connect(this, &QCategory3DAxis::labelsChanged, this, &QAbstract3DAxis::labelsChanged);
}
/*!
- * Destroys Q3DCategoryAxis.
+ * Destroys QCategory3DAxis.
*/
-Q3DCategoryAxis::~Q3DCategoryAxis()
+QCategory3DAxis::~QCategory3DAxis()
{
}
/*!
- * \property Q3DCategoryAxis::labels
+ * \property QCategory3DAxis::labels
*
* Defines labels for axis applied to categories. If there are fewer labels than categories, the
* remaining ones do not have a label. If category labels are not defined explicitly, labels are
- * generated from the data row (or column) labels.
- *
- * \note If the graph has multiple visible series and category labels are not defined explicitly,
- * changing the rows (or columns) on any of the attached series will regenerate the labels.
+ * generated from the data row (or column) labels of the primary series of the graph.
*/
-QStringList Q3DCategoryAxis::labels() const
+QStringList QCategory3DAxis::labels() const
{
- return Q3DAbstractAxis::labels();
+ return QAbstract3DAxis::labels();
}
-void Q3DCategoryAxis::setLabels(const QStringList &labels)
+void QCategory3DAxis::setLabels(const QStringList &labels)
{
dptr()->m_labelsExplicitlySet = !labels.isEmpty();
bool labelsFromData = false;
@@ -118,20 +112,20 @@ void Q3DCategoryAxis::setLabels(const QStringList &labels)
/*!
* \internal
*/
-Q3DCategoryAxisPrivate *Q3DCategoryAxis::dptr()
+QCategory3DAxisPrivate *QCategory3DAxis::dptr()
{
- return static_cast<Q3DCategoryAxisPrivate *>(d_ptr.data());
+ return static_cast<QCategory3DAxisPrivate *>(d_ptr.data());
}
-Q3DCategoryAxisPrivate::Q3DCategoryAxisPrivate(Q3DCategoryAxis *q)
- : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeCategory),
+QCategory3DAxisPrivate::QCategory3DAxisPrivate(QCategory3DAxis *q)
+ : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeCategory),
m_labelsExplicitlySet(false)
{
m_onlyPositiveValues = true;
m_allowMinMaxSame = true;
}
-Q3DCategoryAxisPrivate::~Q3DCategoryAxisPrivate()
+QCategory3DAxisPrivate::~QCategory3DAxisPrivate()
{
}
@@ -140,7 +134,7 @@ Q3DCategoryAxisPrivate::~Q3DCategoryAxisPrivate()
* Controller uses this function to set labels from data proxy as category labels.
* If the labels have been set explicitly by the user, data proxy labels are not used.
*/
-void Q3DCategoryAxisPrivate::setDataLabels(const QStringList &labels)
+void QCategory3DAxisPrivate::setDataLabels(const QStringList &labels)
{
if (!m_labelsExplicitlySet && m_labels != labels) {
m_labels = labels;
@@ -148,9 +142,9 @@ void Q3DCategoryAxisPrivate::setDataLabels(const QStringList &labels)
}
}
-Q3DCategoryAxis *Q3DCategoryAxisPrivate::qptr()
+QCategory3DAxis *QCategory3DAxisPrivate::qptr()
{
- return static_cast<Q3DCategoryAxis *>(q_ptr);
+ return static_cast<QCategory3DAxis *>(q_ptr);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/axis/q3dcategoryaxis.h b/src/datavisualization/axis/qcategory3daxis.h
index 7b2b4744..b16d0444 100644
--- a/src/datavisualization/axis/q3dcategoryaxis.h
+++ b/src/datavisualization/axis/qcategory3daxis.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,23 +16,23 @@
**
****************************************************************************/
-#ifndef Q3DCATEGORYAXIS_H
-#define Q3DCATEGORYAXIS_H
+#ifndef QCATEGORY3DAXIS_H
+#define QCATEGORY3DAXIS_H
-#include <QtDataVisualization/q3dabstractaxis.h>
+#include <QtDataVisualization/qabstract3daxis.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DCategoryAxisPrivate;
+class QCategory3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DCategoryAxis : public Q3DAbstractAxis
+class QT_DATAVISUALIZATION_EXPORT QCategory3DAxis : public QAbstract3DAxis
{
Q_OBJECT
Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged)
public:
- explicit Q3DCategoryAxis(QObject *parent = 0);
- virtual ~Q3DCategoryAxis();
+ explicit QCategory3DAxis(QObject *parent = 0);
+ virtual ~QCategory3DAxis();
void setLabels(const QStringList &labels);
QStringList labels() const;
@@ -41,13 +41,13 @@ signals:
void labelsChanged();
protected:
- Q3DCategoryAxisPrivate *dptr();
+ QCategory3DAxisPrivate *dptr();
private:
- Q_DISABLE_COPY(Q3DCategoryAxis)
+ Q_DISABLE_COPY(QCategory3DAxis)
friend class Bars3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QCATEGORYAXIS_H
+#endif
diff --git a/src/datavisualization/axis/q3dcategoryaxis_p.h b/src/datavisualization/axis/qcategory3daxis_p.h
index 9b66e48a..1ba5ccb0 100644
--- a/src/datavisualization/axis/q3dcategoryaxis_p.h
+++ b/src/datavisualization/axis/qcategory3daxis_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -26,32 +26,32 @@
//
// We mean it.
-#include "q3dcategoryaxis.h"
-#include "q3dabstractaxis_p.h"
+#include "qcategory3daxis.h"
+#include "qabstract3daxis_p.h"
#include "qbardataitem.h"
-#ifndef QCATEGORYAXIS_P_H
-#define QCATEGORYAXIS_P_H
+#ifndef QCATEGORY3DAXIS_P_H
+#define QCATEGORY3DAXIS_P_H
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DCategoryAxisPrivate : public Q3DAbstractAxisPrivate
+class QCategory3DAxisPrivate : public QAbstract3DAxisPrivate
{
Q_OBJECT
public:
- Q3DCategoryAxisPrivate(Q3DCategoryAxis *q);
- virtual ~Q3DCategoryAxisPrivate();
+ QCategory3DAxisPrivate(QCategory3DAxis *q);
+ virtual ~QCategory3DAxisPrivate();
void setDataLabels(const QStringList &labels);
private:
- Q3DCategoryAxis *qptr();
+ QCategory3DAxis *qptr();
bool m_labelsExplicitlySet;
- friend class Q3DCategoryAxis;
+ friend class QCategory3DAxis;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QCATEGORYAXIS_P_H
+#endif
diff --git a/src/datavisualization/axis/q3dvalueaxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp
index 746c8617..52f1e599 100644
--- a/src/datavisualization/axis/q3dvalueaxis.cpp
+++ b/src/datavisualization/axis/qvalue3daxis.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,19 +16,19 @@
**
****************************************************************************/
-#include "q3dvalueaxis.h"
-#include "q3dvalueaxis_p.h"
+#include "qvalue3daxis.h"
+#include "qvalue3daxis_p.h"
#include "utils_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
- * \class Q3DValueAxis
+ * \class QValue3DAxis
* \inmodule QtDataVisualization
- * \brief The Q3DValueAxis class is used for manipulating an axis of a graph.
+ * \brief The QValue3DAxis class is used for manipulating an axis of a graph.
* \since Qt Data Visualization 1.0
*
- * Q3DValueAxis provides an axis that can be given a range of values and segment and subsegment
+ * QValue3DAxis provides an axis that can be given a range of values and segment and subsegment
* counts to divide the range into.
*
* Labels are drawn between each segment. Grid lines are drawn between each segment and each
@@ -41,7 +41,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
* \ingroup datavisualization_qml
- * \instantiates Q3DValueAxis
+ * \instantiates QValue3DAxis
* \inherits AbstractAxis3D
* \brief The ValueAxis3D type is used for manipulating an axis of a graph.
*
@@ -74,23 +74,23 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- * Constructs Q3DValueAxis with the given \a parent.
+ * Constructs QValue3DAxis with the given \a parent.
*/
-Q3DValueAxis::Q3DValueAxis(QObject *parent) :
- Q3DAbstractAxis(new Q3DValueAxisPrivate(this), parent)
+QValue3DAxis::QValue3DAxis(QObject *parent) :
+ QAbstract3DAxis(new QValue3DAxisPrivate(this), parent)
{
}
/*!
- * Destroys Q3DValueAxis.
+ * Destroys QValue3DAxis.
*/
-Q3DValueAxis::~Q3DValueAxis()
+QValue3DAxis::~QValue3DAxis()
{
}
/*!
- * \property Q3DValueAxis::segmentCount
+ * \property QValue3DAxis::segmentCount
*
* Defines the number of segments on the axis. This indicates how many labels are drawn. The number
* of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}.
@@ -98,7 +98,7 @@ Q3DValueAxis::~Q3DValueAxis()
*
* \sa setSubSegmentCount()
*/
-void Q3DValueAxis::setSegmentCount(int count)
+void QValue3DAxis::setSegmentCount(int count)
{
if (count <= 0) {
qWarning() << "Warning: Illegal segment count automatically adjusted to a legal one:"
@@ -112,13 +112,13 @@ void Q3DValueAxis::setSegmentCount(int count)
}
}
-int Q3DValueAxis::segmentCount() const
+int QValue3DAxis::segmentCount() const
{
return dptrc()->m_segmentCount;
}
/*!
- * \property Q3DValueAxis::subSegmentCount
+ * \property QValue3DAxis::subSegmentCount
*
* Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between
* each subsegment, in addition to each segment.
@@ -126,7 +126,7 @@ int Q3DValueAxis::segmentCount() const
*
* \sa setSegmentCount()
*/
-void Q3DValueAxis::setSubSegmentCount(int count)
+void QValue3DAxis::setSubSegmentCount(int count)
{
if (count <= 0) {
qWarning() << "Warning: Illegal subsegment count automatically adjusted to a legal one:"
@@ -139,13 +139,13 @@ void Q3DValueAxis::setSubSegmentCount(int count)
}
}
-int Q3DValueAxis::subSegmentCount() const
+int QValue3DAxis::subSegmentCount() const
{
return dptrc()->m_subSegmentCount;
}
/*!
- * \property Q3DValueAxis::labelFormat
+ * \property QValue3DAxis::labelFormat
*
* Defines the label format to be used for the labels on this axis. Supported specifiers are:
* \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details.
@@ -154,7 +154,7 @@ int Q3DValueAxis::subSegmentCount() const
*
* \c {axis->setLabelFormat("%.2f mm");}
*/
-void Q3DValueAxis::setLabelFormat(const QString &format)
+void QValue3DAxis::setLabelFormat(const QString &format)
{
if (dptr()->m_labelFormat != format) {
dptr()->m_labelFormat = format;
@@ -163,7 +163,7 @@ void Q3DValueAxis::setLabelFormat(const QString &format)
}
}
-QString Q3DValueAxis::labelFormat() const
+QString QValue3DAxis::labelFormat() const
{
return dptrc()->m_labelFormat;
}
@@ -171,21 +171,21 @@ QString Q3DValueAxis::labelFormat() const
/*!
* \internal
*/
-Q3DValueAxisPrivate *Q3DValueAxis::dptr()
+QValue3DAxisPrivate *QValue3DAxis::dptr()
{
- return static_cast<Q3DValueAxisPrivate *>(d_ptr.data());
+ return static_cast<QValue3DAxisPrivate *>(d_ptr.data());
}
/*!
* \internal
*/
-const Q3DValueAxisPrivate *Q3DValueAxis::dptrc() const
+const QValue3DAxisPrivate *QValue3DAxis::dptrc() const
{
- return static_cast<const Q3DValueAxisPrivate *>(d_ptr.data());
+ return static_cast<const QValue3DAxisPrivate *>(d_ptr.data());
}
-Q3DValueAxisPrivate::Q3DValueAxisPrivate(Q3DValueAxis *q)
- : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeValue),
+QValue3DAxisPrivate::QValue3DAxisPrivate(QValue3DAxis *q)
+ : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeValue),
m_segmentCount(5),
m_subSegmentCount(1),
m_labelFormat(Utils::defaultLabelFormat()),
@@ -193,47 +193,47 @@ Q3DValueAxisPrivate::Q3DValueAxisPrivate(Q3DValueAxis *q)
{
}
-Q3DValueAxisPrivate::~Q3DValueAxisPrivate()
+QValue3DAxisPrivate::~QValue3DAxisPrivate()
{
}
-void Q3DValueAxisPrivate::setRange(float min, float max)
+void QValue3DAxisPrivate::setRange(float min, float max)
{
bool dirty = (min != m_min || max != m_max);
- Q3DAbstractAxisPrivate::setRange(min, max);
+ QAbstract3DAxisPrivate::setRange(min, max);
if (dirty)
emitLabelsChanged();
}
-void Q3DValueAxisPrivate::setMin(float min)
+void QValue3DAxisPrivate::setMin(float min)
{
bool dirty = (min != m_min);
- Q3DAbstractAxisPrivate::setMin(min);
+ QAbstract3DAxisPrivate::setMin(min);
if (dirty)
emitLabelsChanged();
}
-void Q3DValueAxisPrivate::setMax(float max)
+void QValue3DAxisPrivate::setMax(float max)
{
bool dirty = (max != m_max);
- Q3DAbstractAxisPrivate::setMax(max);
+ QAbstract3DAxisPrivate::setMax(max);
if (dirty)
emitLabelsChanged();
}
-void Q3DValueAxisPrivate::emitLabelsChanged()
+void QValue3DAxisPrivate::emitLabelsChanged()
{
m_labelsDirty = true;
emit q_ptr->labelsChanged();
}
-void Q3DValueAxisPrivate::updateLabels()
+void QValue3DAxisPrivate::updateLabels()
{
if (!m_labelsDirty)
return;
@@ -262,9 +262,9 @@ void Q3DValueAxisPrivate::updateLabels()
m_labels = newLabels;
}
-Q3DValueAxis *Q3DValueAxisPrivate::qptr()
+QValue3DAxis *QValue3DAxisPrivate::qptr()
{
- return static_cast<Q3DValueAxis *>(q_ptr);
+ return static_cast<QValue3DAxis *>(q_ptr);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/axis/q3dvalueaxis.h b/src/datavisualization/axis/qvalue3daxis.h
index f1280e25..c930c700 100644
--- a/src/datavisualization/axis/q3dvalueaxis.h
+++ b/src/datavisualization/axis/qvalue3daxis.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,16 +16,16 @@
**
****************************************************************************/
-#ifndef QVALUEAXIS_H
-#define QVALUEAXIS_H
+#ifndef QVALUE3DAXIS_H
+#define QVALUE3DAXIS_H
-#include <QtDataVisualization/q3dabstractaxis.h>
+#include <QtDataVisualization/qabstract3daxis.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DValueAxisPrivate;
+class QValue3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DValueAxis : public Q3DAbstractAxis
+class QT_DATAVISUALIZATION_EXPORT QValue3DAxis : public QAbstract3DAxis
{
Q_OBJECT
Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged)
@@ -33,16 +33,17 @@ class QT_DATAVISUALIZATION_EXPORT Q3DValueAxis : public Q3DAbstractAxis
Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
public:
- explicit Q3DValueAxis(QObject *parent = 0);
- virtual ~Q3DValueAxis();
+ explicit QValue3DAxis(QObject *parent = 0);
+ virtual ~QValue3DAxis();
+ void setSegmentCount(int count);
int segmentCount() const;
- int subSegmentCount() const;
- QString labelFormat() const;
- void setSegmentCount(int count);
void setSubSegmentCount(int count);
+ int subSegmentCount() const;
+
void setLabelFormat(const QString &format);
+ QString labelFormat() const;
signals:
void segmentCountChanged(int count);
@@ -50,16 +51,16 @@ signals:
void labelFormatChanged(QString format);
protected:
- Q3DValueAxisPrivate *dptr();
- const Q3DValueAxisPrivate *dptrc() const;
+ QValue3DAxisPrivate *dptr();
+ const QValue3DAxisPrivate *dptrc() const;
private:
- Q_DISABLE_COPY(Q3DValueAxis)
+ Q_DISABLE_COPY(QValue3DAxis)
friend class Bars3DController;
friend class Scatter3DController;
friend class Surface3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QVALUEAXIS_H
+#endif
diff --git a/src/datavisualization/axis/q3dvalueaxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h
index 0a98bb04..21fd78ab 100644
--- a/src/datavisualization/axis/q3dvalueaxis_p.h
+++ b/src/datavisualization/axis/qvalue3daxis_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -26,21 +26,21 @@
//
// We mean it.
-#include "q3dvalueaxis.h"
-#include "q3dabstractaxis_p.h"
+#include "qvalue3daxis.h"
+#include "qabstract3daxis_p.h"
-#ifndef QVALUEAXIS_P_H
-#define QVALUEAXIS_P_H
+#ifndef QVALUE3DAXIS_P_H
+#define QVALUE3DAXIS_P_H
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-class Q3DValueAxisPrivate : public Q3DAbstractAxisPrivate
+class QValue3DAxisPrivate : public QAbstract3DAxisPrivate
{
Q_OBJECT
public:
- Q3DValueAxisPrivate(Q3DValueAxis *q);
- virtual ~Q3DValueAxisPrivate();
+ QValue3DAxisPrivate(QValue3DAxis *q);
+ virtual ~QValue3DAxisPrivate();
virtual void setRange(float min, float max);
virtual void setMin(float min);
@@ -56,11 +56,11 @@ protected:
bool m_labelsDirty;
private:
- Q3DValueAxis *qptr();
+ QValue3DAxis *qptr();
- friend class Q3DValueAxis;
+ friend class QValue3DAxis;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QVALUEAXIS_P_H
+#endif
diff --git a/src/datavisualization/data/abstractitemmodelhandler.cpp b/src/datavisualization/data/abstractitemmodelhandler.cpp
index 41f520a4..63eb7e45 100644
--- a/src/datavisualization/data/abstractitemmodelhandler.cpp
+++ b/src/datavisualization/data/abstractitemmodelhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,11 +19,12 @@
#include "abstractitemmodelhandler_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
AbstractItemModelHandler::AbstractItemModelHandler(QObject *parent)
: QObject(parent),
- resolvePending(0)
+ resolvePending(0),
+ m_fullReset(true)
{
m_resolveTimer.setSingleShot(true);
QObject::connect(&m_resolveTimer, &QTimer::timeout,
@@ -81,9 +82,12 @@ void AbstractItemModelHandler::handleColumnsInserted(const QModelIndex &parent,
Q_UNUSED(start)
Q_UNUSED(end)
- // Resolve new items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Manipulating columns changes all rows in proxies that map rows/columns directly,
+ // and its effects are not clearly defined in others -> always do full reset.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleColumnsMoved(const QModelIndex &sourceParent,
@@ -98,9 +102,12 @@ void AbstractItemModelHandler::handleColumnsMoved(const QModelIndex &sourceParen
Q_UNUSED(destinationParent)
Q_UNUSED(destinationColumn)
- // Resolve moved items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Manipulating columns changes all rows in proxies that map rows/columns directly,
+ // and its effects are not clearly defined in others -> always do full reset.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleColumnsRemoved(const QModelIndex &parent,
@@ -110,9 +117,12 @@ void AbstractItemModelHandler::handleColumnsRemoved(const QModelIndex &parent,
Q_UNUSED(start)
Q_UNUSED(end)
- // Remove old items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Manipulating columns changes all rows in proxies that map rows/columns directly,
+ // and its effects are not clearly defined in others -> always do full reset.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleDataChanged(const QModelIndex &topLeft,
@@ -123,9 +133,13 @@ void AbstractItemModelHandler::handleDataChanged(const QModelIndex &topLeft,
Q_UNUSED(bottomRight)
Q_UNUSED(roles)
- // Resolve changed items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Default handling for dataChanged is to do full reset, as it cannot be optimized
+ // in a general case, where we do not know which row/column/index the item model item
+ // actually ended up to in the proxy.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleLayoutChanged(const QList<QPersistentModelIndex> &parents,
@@ -134,16 +148,20 @@ void AbstractItemModelHandler::handleLayoutChanged(const QList<QPersistentModelI
Q_UNUSED(parents)
Q_UNUSED(hint)
- // Resolve moved items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Resolve entire model if layout changes
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleModelReset()
{
// Data cleared, reset array
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleRowsInserted(const QModelIndex &parent, int start, int end)
@@ -152,9 +170,13 @@ void AbstractItemModelHandler::handleRowsInserted(const QModelIndex &parent, int
Q_UNUSED(start)
Q_UNUSED(end)
- // Resolve new items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Default handling for rowsInserted is to do full reset, as it cannot be optimized
+ // in a general case, where we do not know which row/column/index the item model item
+ // actually ended up to in the proxy.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleRowsMoved(const QModelIndex &sourceParent,
@@ -169,9 +191,13 @@ void AbstractItemModelHandler::handleRowsMoved(const QModelIndex &sourceParent,
Q_UNUSED(destinationParent)
Q_UNUSED(destinationRow)
- // Resolve moved items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Default handling for rowsMoved is to do full reset, as it cannot be optimized
+ // in a general case, where we do not know which row/column/index the item model item
+ // actually ended up to in the proxy.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleRowsRemoved(const QModelIndex &parent, int start, int end)
@@ -180,9 +206,13 @@ void AbstractItemModelHandler::handleRowsRemoved(const QModelIndex &parent, int
Q_UNUSED(start)
Q_UNUSED(end)
- // Resolve removed items
- if (!m_resolveTimer.isActive())
- m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+ // Default handling for rowsRemoved is to do full reset, as it cannot be optimized
+ // in a general case, where we do not know which row/column/index the item model item
+ // actually ended up to in the proxy.
+ if (!m_resolveTimer.isActive()) {
+ m_fullReset = true;
+ m_resolveTimer.start(0);
+ }
}
void AbstractItemModelHandler::handleMappingChanged()
@@ -194,6 +224,7 @@ void AbstractItemModelHandler::handleMappingChanged()
void AbstractItemModelHandler::handlePendingResolve()
{
resolveModel();
+ m_fullReset = false;
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/abstractitemmodelhandler_p.h b/src/datavisualization/data/abstractitemmodelhandler_p.h
index b4d55b4a..c238a63b 100644
--- a/src/datavisualization/data/abstractitemmodelhandler_p.h
+++ b/src/datavisualization/data/abstractitemmodelhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -34,7 +34,7 @@
#include <QPointer>
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class AbstractItemModelHandler : public QObject
{
@@ -74,11 +74,12 @@ protected:
QPointer<const QAbstractItemModel> m_itemModel; // Not owned
bool resolvePending;
QTimer m_resolveTimer;
+ bool m_fullReset;
private:
Q_DISABLE_COPY(AbstractItemModelHandler)
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/abstractrenderitem.cpp b/src/datavisualization/data/abstractrenderitem.cpp
index 22a1c6de..522fd144 100644
--- a/src/datavisualization/data/abstractrenderitem.cpp
+++ b/src/datavisualization/data/abstractrenderitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "abstractrenderitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
AbstractRenderItem::AbstractRenderItem()
: m_selectionLabelItem(0)
@@ -56,5 +56,4 @@ QString &AbstractRenderItem::selectionLabel()
return m_selectionLabel;
}
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/abstractrenderitem_p.h b/src/datavisualization/data/abstractrenderitem_p.h
index 5f623c41..fa06db54 100644
--- a/src/datavisualization/data/abstractrenderitem_p.h
+++ b/src/datavisualization/data/abstractrenderitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -35,8 +35,9 @@
#include <QOpenGLFunctions>
#include <QString>
#include <QVector3D>
+#include <QQuaternion>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class AbstractRenderItem
{
@@ -64,6 +65,6 @@ protected:
friend class QAbstractDataItem;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/baritemmodelhandler.cpp b/src/datavisualization/data/baritemmodelhandler.cpp
index b67a3d8a..611fbcb9 100644
--- a/src/datavisualization/data/baritemmodelhandler.cpp
+++ b/src/datavisualization/data/baritemmodelhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "baritemmodelhandler_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
BarItemModelHandler::BarItemModelHandler(QItemModelBarDataProxy *proxy, QObject *parent)
: AbstractItemModelHandler(parent),
@@ -143,4 +143,4 @@ void BarItemModelHandler::resolveModel()
m_proxy->resetArray(m_proxyArray, rowLabels, columnLabels);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/baritemmodelhandler_p.h b/src/datavisualization/data/baritemmodelhandler_p.h
index 99192b55..7bf7b0a1 100644
--- a/src/datavisualization/data/baritemmodelhandler_p.h
+++ b/src/datavisualization/data/baritemmodelhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "abstractitemmodelhandler_p.h"
#include "qitemmodelbardataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class BarItemModelHandler : public AbstractItemModelHandler
{
@@ -49,6 +49,6 @@ protected:
int m_columnCount;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/barrenderitem.cpp b/src/datavisualization/data/barrenderitem.cpp
index 67029c60..915f3f78 100644
--- a/src/datavisualization/data/barrenderitem.cpp
+++ b/src/datavisualization/data/barrenderitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "barrenderitem_p.h"
#include "bars3drenderer_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
BarRenderItem::BarRenderItem()
: AbstractRenderItem(),
@@ -39,6 +39,7 @@ BarRenderItem::BarRenderItem(const BarRenderItem &other)
m_sliceLabel = other.m_sliceLabel;
m_sliceLabelItem = 0;
m_seriesIndex = other.m_seriesIndex;
+ m_rotation = other.m_rotation;
}
BarRenderItem::~BarRenderItem()
@@ -60,10 +61,9 @@ void BarRenderItem::setSliceLabel(const QString &label)
m_sliceLabel = label;
}
-QString &BarRenderItem::sliceLabel()
+const QString &BarRenderItem::sliceLabel() const
{
return m_sliceLabel;
}
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/barrenderitem_p.h b/src/datavisualization/data/barrenderitem_p.h
index 480d5049..e1062969 100644
--- a/src/datavisualization/data/barrenderitem_p.h
+++ b/src/datavisualization/data/barrenderitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -31,7 +31,7 @@
#include "abstractrenderitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class Bars3DRenderer;
@@ -47,7 +47,15 @@ public:
inline const QPoint &position() const { return m_position; }
// Actual cached data value of the bar (needed to trigger label reformats)
- inline void setValue(float value);
+ inline void setValue(float value)
+ {
+ m_value = value;
+ // Force reformatting on next access by setting label string to null string
+ if (!m_sliceLabel.isNull())
+ setSliceLabel(QString());
+ if (!m_selectionLabel.isNull())
+ setSelectionLabel(QString());
+ }
inline float value() const { return m_value; }
// Normalized bar height
@@ -59,12 +67,15 @@ public:
// Formatted label for item.
void setSliceLabel(const QString &label);
- QString &sliceLabel(); // Formats label if not previously formatted
+ const QString &sliceLabel() const; // Formats label if not previously formatted
// Series index in visual series that this item belongs to.
// This is only utilized by slicing, so it may not be up to date on all items.
inline void setSeriesIndex(int seriesIndex) { m_seriesIndex = seriesIndex; }
- inline int seriesIndex() { return m_seriesIndex; }
+ inline int seriesIndex() const { return m_seriesIndex; }
+
+ inline void setRotation(const QQuaternion &rotation) { m_rotation = rotation; }
+ inline const QQuaternion &rotation() const { return m_rotation; }
protected:
float m_value;
@@ -73,23 +84,14 @@ protected:
QString m_sliceLabel;
LabelItem *m_sliceLabelItem;
int m_seriesIndex;
+ QQuaternion m_rotation;
friend class QBarDataItem;
};
-void BarRenderItem::setValue(float value)
-{
- m_value = value;
- // Force reformatting on next access by setting label string to null string
- if (!m_sliceLabel.isNull())
- setSliceLabel(QString());
- if (!m_selectionLabel.isNull())
- setSelectionLabel(QString());
-}
-
typedef QVector<BarRenderItem> BarRenderItemRow;
typedef QVector<BarRenderItemRow> BarRenderItemArray;
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/labelitem.cpp b/src/datavisualization/data/labelitem.cpp
index 5e27a50e..859b0550 100644
--- a/src/datavisualization/data/labelitem.cpp
+++ b/src/datavisualization/data/labelitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "labelitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
LabelItem::LabelItem()
: m_size(QSize(0, 0)),
@@ -61,4 +61,4 @@ void LabelItem::clear()
m_size = QSize(0, 0);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/labelitem_p.h b/src/datavisualization/data/labelitem_p.h
index c10c1f12..ca60f742 100644
--- a/src/datavisualization/data/labelitem_p.h
+++ b/src/datavisualization/data/labelitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#include <QOpenGLFunctions>
#include <QSize>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class LabelItem
{
@@ -48,12 +48,12 @@ public:
void clear();
private:
- Q_DISABLE_COPY(LabelItem);
+ Q_DISABLE_COPY(LabelItem)
QSize m_size;
GLuint m_textureId;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qabstract3dseries.cpp b/src/datavisualization/data/qabstract3dseries.cpp
index 2c869574..dc241fdb 100644
--- a/src/datavisualization/data/qabstract3dseries.cpp
+++ b/src/datavisualization/data/qabstract3dseries.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -21,7 +21,7 @@
#include "qabstractdataproxy_p.h"
#include "abstract3dcontroller_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QAbstract3DSeries
@@ -34,6 +34,16 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \class QAbstract3DSeriesChangeBitField
+ * \internal
+ */
+
+/*!
+ * \class QAbstract3DSeriesThemeOverrideBitField
+ * \internal
+ */
+
+/*!
* \qmltype Abstract3DSeries
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
@@ -42,10 +52,60 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \brief Base type for all QtDataVisualization series.
*
* This type is uncreatable, but contains properties that are exposed via subtypes.
+ *
+ * For Abstract3DSeries enums, see \l QAbstract3DSeries::SeriesType and \l QAbstract3DSeries::Mesh
+ *
* \sa Bar3DSeries, Scatter3DSeries, Surface3DSeries, {Qt Data Visualization Data Handling}
*/
/*!
+ * \enum QAbstract3DSeries::SeriesType
+ *
+ * Type of the series.
+ *
+ * \value SeriesTypeNone
+ * No series type.
+ * \value SeriesTypeBar
+ * Series type for Q3DBars.
+ * \value SeriesTypeScatter
+ * Series type for Q3DScatter.
+ * \value SeriesTypeSurface
+ * Series type for Q3DSurface.
+ */
+
+/*!
+ * \enum QAbstract3DSeries::Mesh
+ *
+ * Predefined mesh types. All styles are not usable with all visualization types.
+ *
+ * \value MeshUserDefined
+ * User defined mesh, set via QAbstract3DSeries::userDefinedMesh property.
+ * \value MeshBar
+ * Basic rectangular bar.
+ * \value MeshCube
+ * Basic cube.
+ * \value MeshPyramid
+ * Four-sided pyramid.
+ * \value MeshCone
+ * Basic cone.
+ * \value MeshCylinder
+ * Basic cylinder.
+ * \value MeshBevelBar
+ * Slightly beveled (rounded) rectangular bar.
+ * \value MeshBevelCube
+ * Slightly beveled (rounded) cube.
+ * \value MeshSphere
+ * Sphere.
+ * \value MeshMinimal
+ * The minimal 3D mesh: a triangular pyramid. Usable only with Q3DScatter.
+ * \value MeshArrow
+ * Arrow pointing upwards.
+ * \value MeshPoint
+ * 2D point. Usable only with Q3DScatter.
+ * \b Note: Shadows and color gradients do not affect this style.
+ */
+
+/*!
* \qmlproperty Abstract3DSeries.SeriesType Abstract3DSeries::type
* The type of the series.
*/
@@ -82,6 +142,18 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \qmlproperty quaternion Abstract3DSeries::meshRotation
+ *
+ * Sets the mesh \a rotation that is applied to all items of the series.
+ * The \a rotation should be a normalized quaternion.
+ * For those series types that support item specific rotation, the rotations are
+ * multiplied together.
+ * Bar3DSeries ignores any rotation that is not around Y-axis.
+ * Surface3DSeries applies the rotation only to the selection pointer.
+ * Defaults to no rotation.
+ */
+
+/*!
* \qmlproperty string Abstract3DSeries::userDefinedMesh
*
* Sets the \a fileName for user defined custom mesh for objects that is used when mesh
@@ -159,48 +231,12 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- * \enum QAbstract3DSeries::SeriesType
- *
- * Type of the series.
- *
- * \value SeriesTypeNone
- * No series type.
- * \value SeriesTypeBar
- * Series type for Q3DBars.
- * \value SeriesTypeScatter
- * Series type for Q3DScatter.
- * \value SeriesTypeSurface
- * Series type for Q3DSurface.
- */
-
-/*!
- * \enum QAbstract3DSeries::Mesh
+ * \qmlproperty string Abstract3DSeries::name
*
- * Predefined mesh types. All styles are not usable with all visualization types.
+ * Sets the series name.
+ * Series name can be used in item label format with tag \c{@seriesName}.
*
- * \value MeshUserDefined
- * User defined mesh, set via QAbstract3DSeries::userDefinedMesh property.
- * \value MeshBar
- * Basic rectangular bar.
- * \value MeshCube
- * Basic cube.
- * \value MeshPyramid
- * Four-sided pyramid.
- * \value MeshCone
- * Basic cone.
- * \value MeshCylinder
- * Basic cylinder.
- * \value MeshBevelBar
- * Slightly beveled (rounded) rectangular bar.
- * \value MeshBevelCube
- * Slightly beveled (rounded) cube.
- * \value MeshSphere
- * Sphere.
- * \value MeshMinimal
- * The minimal 3D mesh: a triangular pyramid. Usable only with Q3DScatter.
- * \value MeshPoint
- * 2D point. Usable only with Q3DScatter.
- * \b Note: Shadows and color gradients do not affect this style.
+ * \sa itemLabelFormat
*/
/*!
@@ -279,7 +315,8 @@ bool QAbstract3DSeries::isVisible() const
*/
void QAbstract3DSeries::setMesh(QAbstract3DSeries::Mesh mesh)
{
- if ((mesh == QAbstract3DSeries::MeshPoint || mesh == QAbstract3DSeries::MeshMinimal)
+ if ((mesh == QAbstract3DSeries::MeshPoint || mesh == QAbstract3DSeries::MeshMinimal
+ || mesh == QAbstract3DSeries::MeshArrow)
&& type() != QAbstract3DSeries::SeriesTypeScatter) {
qWarning() << "Specified style is only supported for QScatter3DSeries.";
} else if (d_ptr->m_mesh != mesh) {
@@ -314,6 +351,30 @@ bool QAbstract3DSeries::isMeshSmooth() const
}
/*!
+ * \property QAbstract3DSeries::meshRotation
+ *
+ * Sets the mesh \a rotation that is applied to all items of the series.
+ * The \a rotation should be a normalized QQuaternion.
+ * For those series types that support item specific rotation, the rotations are
+ * multiplied together.
+ * QBar3DSeries ignores any rotation that is not around Y-axis.
+ * QSurface3DSeries applies the rotation only to the selection pointer.
+ * Defaults to no rotation.
+ */
+void QAbstract3DSeries::setMeshRotation(const QQuaternion &rotation)
+{
+ if (d_ptr->m_meshRotation != rotation) {
+ d_ptr->setMeshRotation(rotation);
+ emit meshRotationChanged(rotation);
+ }
+}
+
+QQuaternion QAbstract3DSeries::meshRotation() const
+{
+ return d_ptr->m_meshRotation;
+}
+
+/*!
* \property QAbstract3DSeries::userDefinedMesh
*
* Sets the \a fileName for user defined custom mesh for objects that is used when mesh
@@ -486,6 +547,27 @@ QLinearGradient QAbstract3DSeries::multiHighlightGradient() const
return d_ptr->m_multiHighlightGradient;
}
+/*!
+ * \property QAbstract3DSeries::name
+ *
+ * Sets the series name.
+ * Series name can be used in item label format with tag \c{@seriesName}.
+ *
+ * \sa itemLabelFormat
+ */
+void QAbstract3DSeries::setName(const QString &name)
+{
+ if (d_ptr->m_name != name) {
+ d_ptr->setName(name);
+ emit nameChanged(name);
+ }
+}
+
+QString QAbstract3DSeries::name() const
+{
+ return d_ptr->m_name;
+}
+
// QAbstract3DSeriesPrivate
QAbstract3DSeriesPrivate::QAbstract3DSeriesPrivate(QAbstract3DSeries *q, QAbstract3DSeries::SeriesType type)
@@ -563,6 +645,14 @@ void QAbstract3DSeriesPrivate::setMeshSmooth(bool enable)
m_controller->markSeriesVisualsDirty();
}
+void QAbstract3DSeriesPrivate::setMeshRotation(const QQuaternion &rotation)
+{
+ m_meshRotation = rotation;
+ m_changeTracker.meshRotationChanged = true;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
void QAbstract3DSeriesPrivate::setUserDefinedMesh(const QString &meshFile)
{
m_userDefinedMesh = meshFile;
@@ -627,6 +717,14 @@ void QAbstract3DSeriesPrivate::setMultiHighlightGradient(const QLinearGradient &
m_controller->markSeriesVisualsDirty();
}
+void QAbstract3DSeriesPrivate::setName(const QString &name)
+{
+ m_name = name;
+ m_changeTracker.nameChanged = true;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
void QAbstract3DSeriesPrivate::resetToTheme(const Q3DTheme &theme, int seriesIndex, bool force)
{
int themeIndex = seriesIndex;
@@ -664,4 +762,4 @@ void QAbstract3DSeriesPrivate::resetToTheme(const Q3DTheme &theme, int seriesInd
}
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qabstract3dseries.h b/src/datavisualization/data/qabstract3dseries.h
index ebe73510..ebb22b7f 100644
--- a/src/datavisualization/data/qabstract3dseries.h
+++ b/src/datavisualization/data/qabstract3dseries.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,13 +19,13 @@
#ifndef QABSTRACT3DSERIES_H
#define QABSTRACT3DSERIES_H
-#include <QtDataVisualization/qdatavisualizationenums.h>
#include <QtDataVisualization/q3dtheme.h>
#include <QObject>
#include <QScopedPointer>
#include <QLinearGradient>
+#include <QQuaternion>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QAbstract3DSeriesPrivate;
@@ -39,6 +39,7 @@ class QT_DATAVISUALIZATION_EXPORT QAbstract3DSeries : public QObject
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged)
Q_PROPERTY(Mesh mesh READ mesh WRITE setMesh NOTIFY meshChanged)
Q_PROPERTY(bool meshSmooth READ isMeshSmooth WRITE setMeshSmooth NOTIFY meshSmoothChanged)
+ Q_PROPERTY(QQuaternion meshRotation READ meshRotation WRITE setMeshRotation NOTIFY meshRotationChanged)
Q_PROPERTY(QString userDefinedMesh READ userDefinedMesh WRITE setUserDefinedMesh NOTIFY userDefinedMeshChanged)
Q_PROPERTY(QtDataVisualization::Q3DTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged)
@@ -47,6 +48,7 @@ class QT_DATAVISUALIZATION_EXPORT QAbstract3DSeries : public QObject
Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged)
Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor NOTIFY multiHighlightColorChanged)
Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
public:
enum SeriesType {
@@ -67,6 +69,7 @@ public:
MeshBevelCube,
MeshSphere,
MeshMinimal,
+ MeshArrow,
MeshPoint
};
@@ -90,6 +93,9 @@ public:
void setMeshSmooth(bool enable);
bool isMeshSmooth() const;
+ void setMeshRotation(const QQuaternion &rotation);
+ QQuaternion meshRotation() const;
+
void setUserDefinedMesh(const QString &fileName);
QString userDefinedMesh() const;
@@ -108,11 +114,15 @@ public:
void setMultiHighlightGradient(const QLinearGradient &gradient);
QLinearGradient multiHighlightGradient() const;
+ void setName(const QString &name);
+ QString name() const;
+
signals:
void itemLabelFormatChanged(QString format);
void visibilityChanged(bool visible);
void meshChanged(Mesh mesh);
void meshSmoothChanged(bool enabled);
+ void meshRotationChanged(QQuaternion rotation);
void userDefinedMeshChanged(QString fileName);
void colorStyleChanged(Q3DTheme::ColorStyle style);
void baseColorChanged(QColor color);
@@ -121,6 +131,7 @@ signals:
void singleHighlightGradientChanged(QLinearGradient gradient);
void multiHighlightColorChanged(QColor color);
void multiHighlightGradientChanged(QLinearGradient gradient);
+ void nameChanged(QString name);
protected:
QScopedPointer<QAbstract3DSeriesPrivate> d_ptr;
@@ -134,8 +145,9 @@ private:
friend class Scatter3DController;
friend class QBar3DSeries;
friend class SeriesRenderCache;
+ friend class Abstract3DRenderer;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qabstract3dseries_p.h b/src/datavisualization/data/qabstract3dseries_p.h
index 7b2ea2e6..6fbabd3d 100644
--- a/src/datavisualization/data/qabstract3dseries_p.h
+++ b/src/datavisualization/data/qabstract3dseries_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#ifndef QABSTRACT3DSERIES_P_H
#define QABSTRACT3DSERIES_P_H
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QAbstractDataProxy;
class Abstract3DController;
@@ -42,6 +42,7 @@ struct QAbstract3DSeriesChangeBitField {
bool itemLabelFormatChanged : 1;
bool meshChanged : 1;
bool meshSmoothChanged : 1;
+ bool meshRotationChanged : 1;
bool userDefinedMeshChanged : 1;
bool colorStyleChanged : 1;
bool baseColorChanged : 1;
@@ -50,11 +51,13 @@ struct QAbstract3DSeriesChangeBitField {
bool singleHighlightGradientChanged : 1;
bool multiHighlightColorChanged : 1;
bool multiHighlightGradientChanged : 1;
+ bool nameChanged : 1;
QAbstract3DSeriesChangeBitField()
: itemLabelFormatChanged(true),
meshChanged(true),
meshSmoothChanged(true),
+ meshRotationChanged(true),
userDefinedMeshChanged(true),
colorStyleChanged(true),
baseColorChanged(true),
@@ -62,7 +65,8 @@ struct QAbstract3DSeriesChangeBitField {
singleHighlightColorChanged(true),
singleHighlightGradientChanged(true),
multiHighlightColorChanged(true),
- multiHighlightGradientChanged(true)
+ multiHighlightGradientChanged(true),
+ nameChanged(true)
{
}
};
@@ -104,6 +108,7 @@ public:
void setVisible(bool visible);
void setMesh(QAbstract3DSeries::Mesh mesh);
void setMeshSmooth(bool enable);
+ void setMeshRotation(const QQuaternion &rotation);
void setUserDefinedMesh(const QString &meshFile);
void setColorStyle(Q3DTheme::ColorStyle style);
@@ -113,6 +118,7 @@ public:
void setSingleHighlightGradient(const QLinearGradient &gradient);
void setMultiHighlightColor(const QColor &color);
void setMultiHighlightGradient(const QLinearGradient &gradient);
+ void setName(const QString &name);
void resetToTheme(const Q3DTheme &theme, int seriesIndex, bool force);
@@ -126,6 +132,7 @@ public:
Abstract3DController *m_controller;
QAbstract3DSeries::Mesh m_mesh;
bool m_meshSmooth;
+ QQuaternion m_meshRotation;
QString m_userDefinedMesh;
Q3DTheme::ColorStyle m_colorStyle;
@@ -136,8 +143,9 @@ public:
QColor m_multiHighlightColor;
QLinearGradient m_multiHighlightGradient;
+ QString m_name;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QAbstract3DSeries_P_H
+#endif
diff --git a/src/datavisualization/data/qabstractdataproxy.cpp b/src/datavisualization/data/qabstractdataproxy.cpp
index fa0934c3..18d88971 100644
--- a/src/datavisualization/data/qabstractdataproxy.cpp
+++ b/src/datavisualization/data/qabstractdataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "qabstractdataproxy_p.h"
#include "qabstract3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QAbstractDataProxy
@@ -41,6 +41,9 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \brief Base type for all QtDataVisualization data proxies.
*
* This type is uncreatable, but contains properties that are exposed via subtypes.
+ *
+ * For AbstractDataProxy enums, see \l QAbstractDataProxy::DataType
+ *
* \sa BarDataProxy, ScatterDataProxy, SurfaceDataProxy, {Qt Data Visualization Data Handling}
*/
@@ -92,7 +95,8 @@ QAbstractDataProxy::DataType QAbstractDataProxy::type() const
// QAbstractDataProxyPrivate
-QAbstractDataProxyPrivate::QAbstractDataProxyPrivate(QAbstractDataProxy *q, QAbstractDataProxy::DataType type)
+QAbstractDataProxyPrivate::QAbstractDataProxyPrivate(QAbstractDataProxy *q,
+ QAbstractDataProxy::DataType type)
: QObject(0),
q_ptr(q),
m_type(type),
@@ -106,8 +110,8 @@ QAbstractDataProxyPrivate::~QAbstractDataProxyPrivate()
void QAbstractDataProxyPrivate::setSeries(QAbstract3DSeries *series)
{
- setParent(series);
+ q_ptr->setParent(series);
m_series = series;
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qabstractdataproxy.h b/src/datavisualization/data/qabstractdataproxy.h
index 2a053c60..52c2e2c6 100644
--- a/src/datavisualization/data/qabstractdataproxy.h
+++ b/src/datavisualization/data/qabstractdataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,11 +19,12 @@
#ifndef QABSTRACTDATAPROXY_H
#define QABSTRACTDATAPROXY_H
-#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qdatavisualizationglobal.h>
+
#include <QObject>
#include <QScopedPointer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QAbstractDataProxyPrivate;
@@ -58,6 +59,6 @@ private:
friend class QAbstract3DSeriesPrivate;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QABSTRACTDATAPROXY_H
+#endif
diff --git a/src/datavisualization/data/qabstractdataproxy_p.h b/src/datavisualization/data/qabstractdataproxy_p.h
index 90504ccb..093629d5 100644
--- a/src/datavisualization/data/qabstractdataproxy_p.h
+++ b/src/datavisualization/data/qabstractdataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#ifndef QABSTRACTDATAPROXY_P_H
#define QABSTRACTDATAPROXY_P_H
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QAbstract3DSeries;
@@ -56,6 +56,6 @@ private:
friend class QAbstractDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QABSTRACTDATAPROXY_P_H
+#endif
diff --git a/src/datavisualization/data/qbar3dseries.cpp b/src/datavisualization/data/qbar3dseries.cpp
index 18e8b2ed..1440476b 100644
--- a/src/datavisualization/data/qbar3dseries.cpp
+++ b/src/datavisualization/data/qbar3dseries.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "qbar3dseries_p.h"
#include "bars3dcontroller_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QBar3DSeries
@@ -51,7 +51,9 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \li @colLabel \li Label from column axis
* \row
* \li @valueLabel \li Item value formatted using the same format the value axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
+ * \row
+ * \li @seriesName \li Name of the series
* \row
* \li %<format spec> \li Item value in specified format.
* \endtable
@@ -93,16 +95,22 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* Selects a bar at the \a position. The \a position is the (row, column) position in
* the data array of the series.
* Only one bar can be selected at a time.
- * To clear selection, set invalidSelectionPosition() as the \a position.
+ * To clear selection from this series, set invalidSelectionPosition as the \a position.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid. Selecting a bar on another added series will also
* clear the selection.
+ * Removing rows from or inserting rows to the series before the row of the selected bar
+ * will adjust the selection so that the same bar will stay selected.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
- * \qmlmethod point Bar3DSeries::invalidSelectionPosition()
- * \return an invalid position for selection. Set this position to selectedBar property if you
- * want to clear the selection.
+ * \qmlproperty point Bar3DSeries::invalidSelectionPosition
+ * A constant property providing an invalid position for selection. Set this position to
+ * selectedBar property if you want to clear the selection from this series.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
@@ -162,10 +170,14 @@ QBarDataProxy *QBar3DSeries::dataProxy() const
* Selects a bar at the \a position. The \a position is the (row, column) position in
* the data array of the series.
* Only one bar can be selected at a time.
- * To clear selection, set invalidSelectionPosition() as the \a position.
+ * To clear selection from this series, set invalidSelectionPosition() as the \a position.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid. Selecting a bar on another added series will also
* clear the selection.
+ * Removing rows from or inserting rows to the series before the row of the selected bar
+ * will adjust the selection so that the same bar will stay selected.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
void QBar3DSeries::setSelectedBar(const QPoint &position)
{
@@ -183,9 +195,11 @@ QPoint QBar3DSeries::selectedBar() const
/*!
* \return an invalid position for selection. Set this position to selectedBar property if you
- * want to clear the selection.
+ * want to clear the selection from this series.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
-QPoint QBar3DSeries::invalidSelectionPosition() const
+QPoint QBar3DSeries::invalidSelectionPosition()
{
return Bars3DController::invalidSelectionPosition();
}
@@ -212,7 +226,7 @@ QBar3DSeriesPrivate::QBar3DSeriesPrivate(QBar3DSeries *q)
: QAbstract3DSeriesPrivate(q, QAbstract3DSeries::SeriesTypeBar),
m_selectedBar(Bars3DController::invalidSelectionPosition())
{
- m_itemLabelFormat = QStringLiteral("@valueTitle: @valueLabel");
+ m_itemLabelFormat = QStringLiteral("@valueLabel");
m_mesh = QAbstract3DSeries::MeshBevelBar;
}
@@ -273,4 +287,4 @@ void QBar3DSeriesPrivate::setSelectedBar(const QPoint &position)
}
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qbar3dseries.h b/src/datavisualization/data/qbar3dseries.h
index 5883cbfb..be748516 100644
--- a/src/datavisualization/data/qbar3dseries.h
+++ b/src/datavisualization/data/qbar3dseries.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -23,7 +23,7 @@
#include <QtDataVisualization/qbardataproxy.h>
#include <QPoint>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBar3DSeriesPrivate;
@@ -43,7 +43,7 @@ public:
void setSelectedBar(const QPoint &position);
QPoint selectedBar() const;
- QPoint invalidSelectionPosition() const;
+ static QPoint invalidSelectionPosition();
signals:
void dataProxyChanged(QBarDataProxy *proxy);
@@ -60,6 +60,6 @@ private:
friend class Bars3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qbar3dseries_p.h b/src/datavisualization/data/qbar3dseries_p.h
index 89edb84a..173f1cd9 100644
--- a/src/datavisualization/data/qbar3dseries_p.h
+++ b/src/datavisualization/data/qbar3dseries_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qbar3dseries.h"
#include "qabstract3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBar3DSeriesPrivate : public QAbstract3DSeriesPrivate
{
@@ -55,6 +55,6 @@ private:
friend class QBar3DSeries;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qbardataitem.cpp b/src/datavisualization/data/qbardataitem.cpp
index e564bd5d..37c2033f 100644
--- a/src/datavisualization/data/qbardataitem.cpp
+++ b/src/datavisualization/data/qbardataitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "qbardataitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QBarDataItem
@@ -37,7 +37,8 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
QBarDataItem::QBarDataItem()
: d_ptr(0), // private data doesn't exist by default (optimization)
- m_value(0.0f)
+ m_value(0.0f),
+ m_angle(0.0f)
{
}
@@ -46,7 +47,18 @@ QBarDataItem::QBarDataItem()
*/
QBarDataItem::QBarDataItem(float value)
: d_ptr(0),
- m_value(value)
+ m_value(value),
+ m_angle(0.0f)
+{
+}
+
+/*!
+ * Constructs QBarDataItem with \a value and \a angle
+ */
+QBarDataItem::QBarDataItem(float value, float angle)
+ : d_ptr(0),
+ m_value(value),
+ m_angle(angle)
{
}
@@ -72,11 +84,11 @@ QBarDataItem::~QBarDataItem()
QBarDataItem &QBarDataItem::operator=(const QBarDataItem &other)
{
m_value = other.m_value;
+ m_angle = other.m_angle;
if (other.d_ptr)
createExtraData();
else
d_ptr = 0;
- // TODO set extra data
return *this;
}
@@ -91,6 +103,16 @@ QBarDataItem &QBarDataItem::operator=(const QBarDataItem &other)
*/
/*!
+ * \fn void QBarDataItem::setRotation(float angle)
+ * Sets rotation \a angle in degrees for this data item.
+ */
+
+/*!
+ * \fn float QBarDataItem::rotation() const
+ * \return rotation angle in degrees for this data item.
+ */
+
+/*!
* \internal
*/
void QBarDataItem::createExtraData()
@@ -107,4 +129,4 @@ QBarDataItemPrivate::~QBarDataItemPrivate()
{
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qbardataitem.h b/src/datavisualization/data/qbardataitem.h
index 60a4a19f..84e7cd92 100644
--- a/src/datavisualization/data/qbardataitem.h
+++ b/src/datavisualization/data/qbardataitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,9 +19,9 @@
#ifndef QBARDATAITEM_H
#define QBARDATAITEM_H
-#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qdatavisualizationglobal.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBarDataItemPrivate;
@@ -30,13 +30,16 @@ class QT_DATAVISUALIZATION_EXPORT QBarDataItem
public:
QBarDataItem();
QBarDataItem(float value);
+ QBarDataItem(float value, float angle);
QBarDataItem(const QBarDataItem &other);
~QBarDataItem();
QBarDataItem &operator=(const QBarDataItem &other);
- void setValue(float value) { m_value = value; }
- float value() const { return m_value; }
+ inline void setValue(float value) { m_value = value; }
+ inline float value() const { return m_value; }
+ inline void setRotation(float angle) { m_angle = angle; }
+ inline float rotation() const { return m_angle; }
protected:
virtual void createExtraData();
@@ -45,8 +48,9 @@ protected:
private:
float m_value;
+ float m_angle;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qbardataitem_p.h b/src/datavisualization/data/qbardataitem_p.h
index 20b7ea69..c06ddea9 100644
--- a/src/datavisualization/data/qbardataitem_p.h
+++ b/src/datavisualization/data/qbardataitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "datavisualizationglobal_p.h"
#include "qbardataitem.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBarDataItemPrivate
{
@@ -40,12 +40,10 @@ public:
QBarDataItemPrivate();
virtual ~QBarDataItemPrivate();
- // TODO stores other data for bars besides value
-
protected:
friend class QBarDataItem;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qbardataproxy.cpp b/src/datavisualization/data/qbardataproxy.cpp
index 80768059..a26e446e 100644
--- a/src/datavisualization/data/qbardataproxy.cpp
+++ b/src/datavisualization/data/qbardataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "qbardataproxy_p.h"
#include "qbar3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QBarDataProxy
@@ -38,7 +38,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* If you use QBarDataRow pointers to directly modify data after adding the array to the proxy,
* you must also emit proper signal to make the graph update.
*
- * QBarDataProxy optionally keeps track of row and column labels, which Q3DCategoryAxis can utilize
+ * QBarDataProxy optionally keeps track of row and column labels, which QCategory3DAxis can utilize
* to show axis labels. The row and column labels are stored in separate array from the data and
* row manipulation methods provide an alternate versions that don't affect the row labels.
* This enables the option of having row labels that relate to the position of the data in the
@@ -48,6 +48,18 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \typedef QtDataVisualization::QBarDataRow
+ *
+ * A vector of \l {QBarDataItem}s.
+ */
+
+/*!
+ * \typedef QtDataVisualization::QBarDataArray
+ *
+ * A list of pointers to \l {QBarDataRow}s.
+ */
+
+/*!
* \qmltype BarDataProxy
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
@@ -713,4 +725,4 @@ void QBarDataProxyPrivate::setSeries(QAbstract3DSeries *series)
emit qptr()->seriesChanged(barSeries);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qbardataproxy.h b/src/datavisualization/data/qbardataproxy.h
index 94e15116..0ad71365 100644
--- a/src/datavisualization/data/qbardataproxy.h
+++ b/src/datavisualization/data/qbardataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -24,10 +24,13 @@
#include <QVector>
#include <QStringList>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
-
+namespace QtDataVisualization {
+// typedefs introduced this way because QDoc doesn't understand namespace macros
typedef QVector<QBarDataItem> QBarDataRow;
typedef QList<QBarDataRow *> QBarDataArray;
+}
+
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBarDataProxyPrivate;
class QBar3DSeries;
@@ -104,6 +107,6 @@ private:
friend class Bars3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QBARDATAPROXY_H
+#endif
diff --git a/src/datavisualization/data/qbardataproxy_p.h b/src/datavisualization/data/qbardataproxy_p.h
index 84726a02..eb0a0873 100644
--- a/src/datavisualization/data/qbardataproxy_p.h
+++ b/src/datavisualization/data/qbardataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#include "qabstractdataproxy_p.h"
#include "qbardataitem.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QBarDataProxyPrivate : public QAbstractDataProxyPrivate
{
@@ -72,6 +72,6 @@ private:
friend class QBarDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QBARDATAPROXY_P_H
+#endif
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy.cpp b/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
index ce379592..9ac5c90f 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "qheightmapsurfacedataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
// Default ranges correspond value axis defaults
const float defaultMinValue = 0.0f;
@@ -296,9 +296,7 @@ const QHeightMapSurfaceDataProxyPrivate *QHeightMapSurfaceDataProxy::dptrc() con
return static_cast<const QHeightMapSurfaceDataProxyPrivate *>(d_ptr.data());
}
-//
// QHeightMapSurfaceDataProxyPrivate
-//
QHeightMapSurfaceDataProxyPrivate::QHeightMapSurfaceDataProxyPrivate(QHeightMapSurfaceDataProxy *q)
: QSurfaceDataProxyPrivate(q),
@@ -321,7 +319,8 @@ QHeightMapSurfaceDataProxy *QHeightMapSurfaceDataProxyPrivate::qptr()
return static_cast<QHeightMapSurfaceDataProxy *>(q_ptr);
}
-void QHeightMapSurfaceDataProxyPrivate::setValueRanges(float minX, float maxX, float minZ, float maxZ)
+void QHeightMapSurfaceDataProxyPrivate::setValueRanges(float minX, float maxX,
+ float minZ, float maxZ)
{
bool minXChanged = false;
bool maxXChanged = false;
@@ -509,10 +508,10 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
for (; j < lastCol; j++)
newRow[j].setPosition(QVector3D((float(j) * xMul) + m_minXValue,
float(bits[bitCount + (j * 4)]),
- zVal));
+ zVal));
newRow[j].setPosition(QVector3D(m_maxXValue,
float(bits[bitCount + (j * 4)]),
- zVal));
+ zVal));
}
} else {
// Not grayscale, we'll need to calculate height from RGB
@@ -548,4 +547,4 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
emit qptr()->heightMapChanged(m_heightMap);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy.h b/src/datavisualization/data/qheightmapsurfacedataproxy.h
index 16132b0d..d506d4e8 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy.h
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -23,7 +23,7 @@
#include <QImage>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QHeightMapSurfaceDataProxyPrivate;
@@ -77,6 +77,6 @@ private:
friend class Surface3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy_p.h b/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
index 2d773344..0e947666 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#include "qsurfacedataproxy_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QHeightMapSurfaceDataProxyPrivate : public QSurfaceDataProxyPrivate
{
@@ -64,6 +64,6 @@ private:
friend class QHeightMapSurfaceDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelbardataproxy.cpp b/src/datavisualization/data/qitemmodelbardataproxy.cpp
index e3354015..97289da1 100644
--- a/src/datavisualization/data/qitemmodelbardataproxy.cpp
+++ b/src/datavisualization/data/qitemmodelbardataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "baritemmodelhandler_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QItemModelBarDataProxy
@@ -446,6 +446,27 @@ const QItemModelBarDataProxyPrivate *QItemModelBarDataProxy::dptrc() const
return static_cast<const QItemModelBarDataProxyPrivate *>(d_ptr.data());
}
+// QItemModelBarDataProxyPrivate
+
+QItemModelBarDataProxyPrivate::QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q)
+ : QBarDataProxyPrivate(q),
+ m_itemModelHandler(new BarItemModelHandler(q)),
+ m_useModelCategories(false),
+ m_autoRowCategories(true),
+ m_autoColumnCategories(true)
+{
+}
+
+QItemModelBarDataProxyPrivate::~QItemModelBarDataProxyPrivate()
+{
+ delete m_itemModelHandler;
+}
+
+QItemModelBarDataProxy *QItemModelBarDataProxyPrivate::qptr()
+{
+ return static_cast<QItemModelBarDataProxy *>(q_ptr);
+}
+
void QItemModelBarDataProxyPrivate::connectItemModelHandler()
{
QObject::connect(m_itemModelHandler, &BarItemModelHandler::itemModelChanged,
@@ -468,25 +489,4 @@ void QItemModelBarDataProxyPrivate::connectItemModelHandler()
m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
}
-// QItemModelBarDataProxyPrivate
-
-QItemModelBarDataProxyPrivate::QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q)
- : QBarDataProxyPrivate(q),
- m_itemModelHandler(new BarItemModelHandler(q)),
- m_useModelCategories(false),
- m_autoRowCategories(true),
- m_autoColumnCategories(true)
-{
-}
-
-QItemModelBarDataProxyPrivate::~QItemModelBarDataProxyPrivate()
-{
- delete m_itemModelHandler;
-}
-
-QItemModelBarDataProxy *QItemModelBarDataProxyPrivate::qptr()
-{
- return static_cast<QItemModelBarDataProxy *>(q_ptr);
-}
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qitemmodelbardataproxy.h b/src/datavisualization/data/qitemmodelbardataproxy.h
index 597ab48f..4e62b4c3 100644
--- a/src/datavisualization/data/qitemmodelbardataproxy.h
+++ b/src/datavisualization/data/qitemmodelbardataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -23,7 +23,7 @@
#include <QAbstractItemModel>
#include <QStringList>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QItemModelBarDataProxyPrivate;
@@ -104,6 +104,6 @@ private:
friend class BarItemModelHandler;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelbardataproxy_p.h b/src/datavisualization/data/qitemmodelbardataproxy_p.h
index 63c5b3ff..0c987a00 100644
--- a/src/datavisualization/data/qitemmodelbardataproxy_p.h
+++ b/src/datavisualization/data/qitemmodelbardataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qitemmodelbardataproxy.h"
#include "qbardataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class BarItemModelHandler;
@@ -66,6 +66,6 @@ private:
friend class QItemModelBarDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy.cpp b/src/datavisualization/data/qitemmodelscatterdataproxy.cpp
index 50b57423..1edee53c 100644
--- a/src/datavisualization/data/qitemmodelscatterdataproxy.cpp
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "scatteritemmodelhandler_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QItemModelScatterDataProxy
@@ -32,7 +32,9 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* for Q3DScatter. It maps roles of QAbstractItemModel to the XYZ-values of Q3DScatter points.
*
* The data is resolved asynchronously whenever the mapping or the model changes.
- * QScatterDataProxy::arrayReset() is emitted when the data has been resolved.
+ * QScatterDataProxy::arrayReset() is emitted when the data has been resolved. However, inserts,
+ * removes, and single data item changes after the model initialization are resolved synchronously,
+ * unless the same frame also contains a change that causes the whole model to be resolved.
*
* Mapping ignores rows and columns of the QAbstractItemModel and treats
* all items equally. It requires the model to provide at least three roles for the data items
@@ -235,18 +237,6 @@ const QItemModelScatterDataProxyPrivate *QItemModelScatterDataProxy::dptrc() con
return static_cast<const QItemModelScatterDataProxyPrivate *>(d_ptr.data());
}
-void QItemModelScatterDataProxyPrivate::connectItemModelHandler()
-{
- QObject::connect(m_itemModelHandler, &ScatterItemModelHandler::itemModelChanged,
- qptr(), &QItemModelScatterDataProxy::itemModelChanged);
- QObject::connect(qptr(), &QItemModelScatterDataProxy::xPosRoleChanged,
- m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
- QObject::connect(qptr(), &QItemModelScatterDataProxy::yPosRoleChanged,
- m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
- QObject::connect(qptr(), &QItemModelScatterDataProxy::zPosRoleChanged,
- m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
-}
-
// QItemModelScatterDataProxyPrivate
QItemModelScatterDataProxyPrivate::QItemModelScatterDataProxyPrivate(QItemModelScatterDataProxy *q)
@@ -265,4 +255,16 @@ QItemModelScatterDataProxy *QItemModelScatterDataProxyPrivate::qptr()
return static_cast<QItemModelScatterDataProxy *>(q_ptr);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+void QItemModelScatterDataProxyPrivate::connectItemModelHandler()
+{
+ QObject::connect(m_itemModelHandler, &ScatterItemModelHandler::itemModelChanged,
+ qptr(), &QItemModelScatterDataProxy::itemModelChanged);
+ QObject::connect(qptr(), &QItemModelScatterDataProxy::xPosRoleChanged,
+ m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
+ QObject::connect(qptr(), &QItemModelScatterDataProxy::yPosRoleChanged,
+ m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
+ QObject::connect(qptr(), &QItemModelScatterDataProxy::zPosRoleChanged,
+ m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
+}
+
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy.h b/src/datavisualization/data/qitemmodelscatterdataproxy.h
index f2a7d78c..0f69afa7 100644
--- a/src/datavisualization/data/qitemmodelscatterdataproxy.h
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -23,7 +23,7 @@
#include <QAbstractItemModel>
#include <QStringList>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QItemModelScatterDataProxyPrivate;
@@ -71,6 +71,6 @@ private:
friend class ScatterItemModelHandler;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy_p.h b/src/datavisualization/data/qitemmodelscatterdataproxy_p.h
index 8c86ef09..b8804c5c 100644
--- a/src/datavisualization/data/qitemmodelscatterdataproxy_p.h
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qitemmodelscatterdataproxy.h"
#include "qscatterdataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class ScatterItemModelHandler;
@@ -57,6 +57,6 @@ private:
friend class QItemModelScatterDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp b/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp
index 191e0d7f..0c206b81 100644
--- a/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,9 +20,7 @@
#include "surfaceitemmodelhandler_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
-
-// TODO: CHECK DOCUMENTATION!
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QItemModelSurfaceDataProxy
@@ -160,7 +158,8 @@ QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(QObject *parent)
* Constructs QItemModelSurfaceDataProxy with \a itemModel and optional \a parent. Proxy doesn't take
* ownership of the \a itemModel, as typically item models are owned by other controls.
*/
-QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel, QObject *parent)
+QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel,
+ QObject *parent)
: QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this), parent)
{
dptr()->m_itemModelHandler->setItemModel(itemModel);
@@ -175,7 +174,8 @@ QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel
* in rows and columns already, so it also sets useModelCategories property to true.
*/
QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel,
- const QString &valueRole, QObject *parent)
+ const QString &valueRole,
+ QObject *parent)
: QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this), parent)
{
dptr()->m_itemModelHandler->setItemModel(itemModel);
@@ -192,7 +192,8 @@ QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel
QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel,
const QString &rowRole,
const QString &columnRole,
- const QString &valueRole, QObject *parent)
+ const QString &valueRole,
+ QObject *parent)
: QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this), parent)
{
dptr()->m_itemModelHandler->setItemModel(itemModel);
@@ -456,6 +457,27 @@ const QItemModelSurfaceDataProxyPrivate *QItemModelSurfaceDataProxy::dptrc() con
return static_cast<const QItemModelSurfaceDataProxyPrivate *>(d_ptr.data());
}
+// QItemModelSurfaceDataProxyPrivate
+
+QItemModelSurfaceDataProxyPrivate::QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q)
+ : QSurfaceDataProxyPrivate(q),
+ m_itemModelHandler(new SurfaceItemModelHandler(q)),
+ m_useModelCategories(false),
+ m_autoRowCategories(true),
+ m_autoColumnCategories(true)
+{
+}
+
+QItemModelSurfaceDataProxyPrivate::~QItemModelSurfaceDataProxyPrivate()
+{
+ delete m_itemModelHandler;
+}
+
+QItemModelSurfaceDataProxy *QItemModelSurfaceDataProxyPrivate::qptr()
+{
+ return static_cast<QItemModelSurfaceDataProxy *>(q_ptr);
+}
+
void QItemModelSurfaceDataProxyPrivate::connectItemModelHandler()
{
QObject::connect(m_itemModelHandler, &SurfaceItemModelHandler::itemModelChanged,
@@ -478,25 +500,4 @@ void QItemModelSurfaceDataProxyPrivate::connectItemModelHandler()
m_itemModelHandler, &AbstractItemModelHandler::handleMappingChanged);
}
-// QItemModelSurfaceDataProxyPrivate
-
-QItemModelSurfaceDataProxyPrivate::QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q)
- : QSurfaceDataProxyPrivate(q),
- m_itemModelHandler(new SurfaceItemModelHandler(q)),
- m_useModelCategories(false),
- m_autoRowCategories(true),
- m_autoColumnCategories(true)
-{
-}
-
-QItemModelSurfaceDataProxyPrivate::~QItemModelSurfaceDataProxyPrivate()
-{
- delete m_itemModelHandler;
-}
-
-QItemModelSurfaceDataProxy *QItemModelSurfaceDataProxyPrivate::qptr()
-{
- return static_cast<QItemModelSurfaceDataProxy *>(q_ptr);
-}
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy.h b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
index ee6b4d99..d1e0f2b8 100644
--- a/src/datavisualization/data/qitemmodelsurfacedataproxy.h
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -23,7 +23,7 @@
#include <QAbstractItemModel>
#include <QStringList>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QItemModelSurfaceDataProxyPrivate;
@@ -104,6 +104,6 @@ private:
friend class SurfaceItemModelHandler;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h b/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h
index e4505c40..5049a25e 100644
--- a/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qitemmodelsurfacedataproxy.h"
#include "qsurfacedataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class SurfaceItemModelHandler;
@@ -66,6 +66,6 @@ private:
friend class QItemModelSurfaceDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatter3dseries.cpp b/src/datavisualization/data/qscatter3dseries.cpp
index 47971f5f..43bde4dd 100644
--- a/src/datavisualization/data/qscatter3dseries.cpp
+++ b/src/datavisualization/data/qscatter3dseries.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "qscatter3dseries_p.h"
#include "scatter3dcontroller_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QScatter3DSeries
@@ -43,13 +43,15 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \li @zTitle \li Title from Z axis
* \row
* \li @xLabel \li Item value formatted using the same format the X axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
* \row
* \li @yLabel \li Item value formatted using the same format the Y axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
* \row
* \li @zLabel \li Item value formatted using the same format the Z axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
+ * \row
+ * \li @seriesName \li Name of the series
* \endtable
*
* For example:
@@ -88,10 +90,14 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*
* Selects an item at the \a index. The \a index is the index in the data array of the series.
* Only one item can be selected at a time.
- * To clear selection, set invalidSelectionIndex() as the \a index.
+ * To clear selection from this series, set invalidSelectionIndex as the \a index.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid. Selecting an item on another added series will also
* clear the selection.
+ * Removing items from or inserting items to the series before the selected item
+ * will adjust the selection so that the same item will stay selected.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
@@ -103,9 +109,11 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- * \qmlmethod int Scatter3DSeries::invalidSelectionIndex()
- * \return an invalid index for selection. Set this index to selectedItem property if you
- * want to clear the selection.
+ * \qmlproperty int Scatter3DSeries::invalidSelectionIndex
+ * A constant property providing an invalid index for selection. Set this index to
+ * selectedItem property if you want to clear the selection from this series.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
@@ -164,10 +172,14 @@ QScatterDataProxy *QScatter3DSeries::dataProxy() const
*
* Selects an item at the \a index. The \a index is the index in the data array of the series.
* Only one item can be selected at a time.
- * To clear selection, set invalidSelectionIndex() as the \a index.
+ * To clear selection from this series, set invalidSelectionIndex() as the \a index.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid. Selecting an item on another added series will also
* clear the selection.
+ * Removing items from or inserting items to the series before the selected item
+ * will adjust the selection so that the same item will stay selected.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
void QScatter3DSeries::setSelectedItem(int index)
{
@@ -207,9 +219,11 @@ float QScatter3DSeries::itemSize() const
/*!
* \return an invalid index for selection. Set this index to selectedItem property if you
- * want to clear the selection.
+ * want to clear the selection from this series.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
-int QScatter3DSeries::invalidSelectionIndex() const
+int QScatter3DSeries::invalidSelectionIndex()
{
return Scatter3DController::invalidSelectionIndex();
}
@@ -237,7 +251,7 @@ QScatter3DSeriesPrivate::QScatter3DSeriesPrivate(QScatter3DSeries *q)
m_selectedItem(Scatter3DController::invalidSelectionIndex()),
m_itemSize(0.0f)
{
- m_itemLabelFormat = QStringLiteral("@valueTitle: @valueLabel");
+ m_itemLabelFormat = QStringLiteral("@xLabel, @yLabel, @zLabel");
m_mesh = QAbstract3DSeries::MeshSphere;
}
@@ -299,4 +313,4 @@ void QScatter3DSeriesPrivate::setItemSize(float size)
m_controller->markSeriesVisualsDirty();
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qscatter3dseries.h b/src/datavisualization/data/qscatter3dseries.h
index 1d9abc11..437c7fd1 100644
--- a/src/datavisualization/data/qscatter3dseries.h
+++ b/src/datavisualization/data/qscatter3dseries.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -22,7 +22,7 @@
#include <QtDataVisualization/qabstract3dseries.h>
#include <QtDataVisualization/qscatterdataproxy.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatter3DSeriesPrivate;
@@ -43,12 +43,11 @@ public:
void setSelectedItem(int index);
int selectedItem() const;
+ static int invalidSelectionIndex();
void setItemSize(float size);
float itemSize() const;
- Q_INVOKABLE int invalidSelectionIndex() const;
-
signals:
void dataProxyChanged(QScatterDataProxy *proxy);
void selectedItemChanged(int index);
@@ -65,6 +64,6 @@ private:
friend class Scatter3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatter3dseries_p.h b/src/datavisualization/data/qscatter3dseries_p.h
index a09536c9..1abbd406 100644
--- a/src/datavisualization/data/qscatter3dseries_p.h
+++ b/src/datavisualization/data/qscatter3dseries_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qscatter3dseries.h"
#include "qabstract3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatter3DSeriesPrivate : public QAbstract3DSeriesPrivate
{
@@ -56,6 +56,6 @@ private:
friend class QScatter3DSeries;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatterdataitem.cpp b/src/datavisualization/data/qscatterdataitem.cpp
index 2c0c0d5a..33f8bed0 100644
--- a/src/datavisualization/data/qscatterdataitem.cpp
+++ b/src/datavisualization/data/qscatterdataitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "qscatterdataitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QScatterDataItem
@@ -72,6 +72,7 @@ QScatterDataItem::~QScatterDataItem()
QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other)
{
m_position = other.m_position;
+ m_rotation = other.m_rotation;
if (other.d_ptr)
createExtraData();
@@ -92,6 +93,20 @@ QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other)
*/
/*!
+ * \fn void QScatterDataItem::setRotation(const QQuaternion &rotation)
+ * Sets \a rotation to this data item.
+ * The \a rotation should be a normalized QQuaternion.
+ * If the series also has rotation, item and series rotations are multiplied together.
+ * Defaults to no rotation.
+ */
+
+/*!
+ * \fn QQuaternion QScatterDataItem::rotation() const
+ * \return rotation of this data item.
+ * \sa setRotation()
+ */
+
+/*!
* \fn void QScatterDataItem::setX(float value)
* Sets the X component of the item position to the \a value.
*/
@@ -138,4 +153,4 @@ QScatterDataItemPrivate::~QScatterDataItemPrivate()
{
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qscatterdataitem.h b/src/datavisualization/data/qscatterdataitem.h
index 7992864c..d2ef3bcc 100644
--- a/src/datavisualization/data/qscatterdataitem.h
+++ b/src/datavisualization/data/qscatterdataitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,10 +19,12 @@
#ifndef QSCATTERDATAITEM_H
#define QSCATTERDATAITEM_H
-#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qdatavisualizationglobal.h>
+
#include <QVector3D>
+#include <QQuaternion>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatterDataItemPrivate;
@@ -38,6 +40,8 @@ public:
inline void setPosition(const QVector3D &position) { m_position = position; }
inline QVector3D position() const { return m_position; }
+ inline void setRotation(const QQuaternion &rotation) { m_rotation = rotation; }
+ inline QQuaternion rotation() const { return m_rotation; }
inline void setX(float value) { m_position.setX(value); }
inline void setY(float value) { m_position.setY(value); }
inline void setZ(float value) { m_position.setZ(value); }
@@ -52,8 +56,9 @@ protected:
private:
QVector3D m_position;
+ QQuaternion m_rotation;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatterdataitem_p.h b/src/datavisualization/data/qscatterdataitem_p.h
index acc67347..efb1cc5c 100644
--- a/src/datavisualization/data/qscatterdataitem_p.h
+++ b/src/datavisualization/data/qscatterdataitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "datavisualizationglobal_p.h"
#include "qscatterdataitem.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatterDataItemPrivate
{
@@ -40,12 +40,10 @@ public:
QScatterDataItemPrivate();
virtual ~QScatterDataItemPrivate();
- // TODO stores other data for scatter items besides position
-
protected:
friend class QScatterDataItem;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatterdataproxy.cpp b/src/datavisualization/data/qscatterdataproxy.cpp
index e0876d64..b5e3863d 100644
--- a/src/datavisualization/data/qscatterdataproxy.cpp
+++ b/src/datavisualization/data/qscatterdataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "qscatterdataproxy_p.h"
#include "qscatter3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QScatterDataProxy
@@ -36,6 +36,12 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \typedef QtDataVisualization::QScatterDataArray
+ *
+ * A vector of \l {QScatterDataItem}s.
+ */
+
+/*!
* \qmltype ScatterDataProxy
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
@@ -408,4 +414,4 @@ QScatterDataProxy *QScatterDataProxyPrivate::qptr()
return static_cast<QScatterDataProxy *>(q_ptr);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qscatterdataproxy.h b/src/datavisualization/data/qscatterdataproxy.h
index acb3d3d4..b8179166 100644
--- a/src/datavisualization/data/qscatterdataproxy.h
+++ b/src/datavisualization/data/qscatterdataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -22,9 +22,12 @@
#include <QtDataVisualization/qabstractdataproxy.h>
#include <QtDataVisualization/qscatterdataitem.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
-
+namespace QtDataVisualization {
+// typedef introduced this way because QDoc doesn't understand namespace macros
typedef QVector<QScatterDataItem> QScatterDataArray;
+}
+
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatterDataProxyPrivate;
class QScatter3DSeries;
@@ -79,6 +82,6 @@ private:
friend class Scatter3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qscatterdataproxy_p.h b/src/datavisualization/data/qscatterdataproxy_p.h
index 322c8937..ccd37bda 100644
--- a/src/datavisualization/data/qscatterdataproxy_p.h
+++ b/src/datavisualization/data/qscatterdataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -33,7 +33,7 @@
#include "qabstractdataproxy_p.h"
#include "qscatterdataitem.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QScatterDataProxyPrivate : public QAbstractDataProxyPrivate
{
@@ -61,6 +61,6 @@ private:
friend class QScatterDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QBARDATAPROXY_P_H
+#endif
diff --git a/src/datavisualization/data/qsurface3dseries.cpp b/src/datavisualization/data/qsurface3dseries.cpp
index cf794077..e5f06cc6 100644
--- a/src/datavisualization/data/qsurface3dseries.cpp
+++ b/src/datavisualization/data/qsurface3dseries.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,7 @@
#include "qsurface3dseries_p.h"
#include "surface3dcontroller_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QSurface3DSeries
@@ -46,13 +46,15 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \li @zTitle \li Title from Z axis
* \row
* \li @xLabel \li Item value formatted using the same format as the X axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
* \row
* \li @yLabel \li Item value formatted using the same format as the Y axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
* \row
* \li @zLabel \li Item value formatted using the same format as the Z axis attached to the graph uses,
- * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * see \l{QValue3DAxis::setLabelFormat()} for more information.
+ * \row
+ * \li @seriesName \li Name of the series
* \endtable
*
* For example:
@@ -73,6 +75,8 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* This type manages the series specific visual elements, as well as series data
* (via data proxy).
*
+ * For Surface3DSeries enums, see \l QSurface3DSeries::DrawFlag
+ *
* For more complete description, see QSurface3DSeries.
*
* \sa {Qt Data Visualization Data Handling}
@@ -92,15 +96,21 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* Selects a surface grid point in a \a position. The position is the (row, column) position in
* the data array of the series.
* Only one point can be selected at a time.
- * To clear selection, set invalidSelectionPosition() as the \a position.
+ * To clear selection from this series, set invalidSelectionPosition as the \a position.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid.
+ * Removing rows from or inserting rows to the series before the row of the selected point
+ * will adjust the selection so that the same point will stay selected.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
- * \qmlmethod point Surface3DSeries::invalidSelectionPosition()
- * \return a point signifying an invalid selection position. Set this to selectedPoint property
- * to clear the selection.
+ * \qmlproperty point Surface3DSeries::invalidSelectionPosition
+ * A constant property providing an invalid selection position.
+ * Set this to selectedPoint property to clear the selection from this series.
+ *
+ * \sa AbstractGraph3D::clearSelection()
*/
/*!
@@ -199,9 +209,13 @@ QSurfaceDataProxy *QSurface3DSeries::dataProxy() const
* Selects a surface grid point in a \a position. The position is the (row, column) position in
* the data array of the series.
* Only one point can be selected at a time.
- * To clear selection, set invalidSelectionPosition() as the \a position.
+ * To clear selection from this series, set invalidSelectionPosition() as the \a position.
* If this series is added to a graph, the graph can adjust the selection according to user
* interaction or if it becomes invalid.
+ * Removing rows from or inserting rows to the series before the row of the selected point
+ * will adjust the selection so that the same point will stay selected.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
void QSurface3DSeries::setSelectedPoint(const QPoint &position)
{
@@ -219,9 +233,11 @@ QPoint QSurface3DSeries::selectedPoint() const
/*!
* \return a QPoint signifying an invalid selection position. Set this to selectedPoint property
- * to clear the selection.
+ * to clear the selection from this series.
+ *
+ * \sa QAbstract3DGraph::clearSelection()
*/
-QPoint QSurface3DSeries::invalidSelectionPosition() const
+QPoint QSurface3DSeries::invalidSelectionPosition()
{
return Surface3DController::invalidSelectionPosition();
}
@@ -306,7 +322,7 @@ QSurface3DSeriesPrivate::QSurface3DSeriesPrivate(QSurface3DSeries *q)
m_flatShadingEnabled(true),
m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe)
{
- m_itemLabelFormat = QStringLiteral("(@xLabel, @yLabel, @zLabel)");
+ m_itemLabelFormat = QStringLiteral("@xLabel, @yLabel, @zLabel");
m_mesh = QAbstract3DSeries::MeshSphere;
}
@@ -378,4 +394,4 @@ void QSurface3DSeriesPrivate::setDrawMode(QSurface3DSeries::DrawFlags mode)
m_controller->markSeriesVisualsDirty();
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qsurface3dseries.h b/src/datavisualization/data/qsurface3dseries.h
index 6681495b..b8a1a62b 100644
--- a/src/datavisualization/data/qsurface3dseries.h
+++ b/src/datavisualization/data/qsurface3dseries.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -22,7 +22,7 @@
#include <QtDataVisualization/qabstract3dseries.h>
#include <QtDataVisualization/qsurfacedataproxy.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurface3DSeriesPrivate;
@@ -34,7 +34,7 @@ class QT_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
Q_PROPERTY(QPoint selectedPoint READ selectedPoint WRITE setSelectedPoint NOTIFY selectedPointChanged)
Q_PROPERTY(bool flatShadingEnabled READ isFlatShadingEnabled WRITE setFlatShadingEnabled NOTIFY flatShadingEnabledChanged)
Q_PROPERTY(bool flatShadingSupported READ isFlatShadingSupported NOTIFY flatShadingSupportedChanged)
- Q_PROPERTY(QtDataVisualization::QSurface3DSeries::DrawFlags drawMode READ drawMode WRITE setDrawMode NOTIFY drawModeChanged)
+ Q_PROPERTY(DrawFlags drawMode READ drawMode WRITE setDrawMode NOTIFY drawModeChanged)
public:
enum DrawFlag {
@@ -53,7 +53,7 @@ public:
void setSelectedPoint(const QPoint &position);
QPoint selectedPoint() const;
- QPoint invalidSelectionPosition() const;
+ static QPoint invalidSelectionPosition();
void setFlatShadingEnabled(bool enabled);
bool isFlatShadingEnabled() const;
@@ -81,6 +81,6 @@ private:
friend class Surface3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qsurface3dseries_p.h b/src/datavisualization/data/qsurface3dseries_p.h
index 00bfbed2..bc8157bd 100644
--- a/src/datavisualization/data/qsurface3dseries_p.h
+++ b/src/datavisualization/data/qsurface3dseries_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "qsurface3dseries.h"
#include "qabstract3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurface3DSeriesPrivate : public QAbstract3DSeriesPrivate
{
@@ -59,6 +59,6 @@ private:
friend class QSurface3DSeries;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qsurfacedataitem.cpp b/src/datavisualization/data/qsurfacedataitem.cpp
index f5f91464..c8a76a67 100644
--- a/src/datavisualization/data/qsurfacedataitem.cpp
+++ b/src/datavisualization/data/qsurfacedataitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "qsurfacedataitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QSurfaceDataItem
@@ -72,13 +72,11 @@ QSurfaceDataItem::~QSurfaceDataItem()
QSurfaceDataItem &QSurfaceDataItem::operator=(const QSurfaceDataItem &other)
{
m_position = other.m_position;
- //m_size = other.m_size;
if (other.d_ptr)
createExtraData();
else
d_ptr = 0;
- // TODO set extra data
return *this;
}
@@ -140,4 +138,4 @@ QSurfaceDataItemPrivate::~QSurfaceDataItemPrivate()
{
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qsurfacedataitem.h b/src/datavisualization/data/qsurfacedataitem.h
index dbc849d3..f305952b 100644
--- a/src/datavisualization/data/qsurfacedataitem.h
+++ b/src/datavisualization/data/qsurfacedataitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,10 +19,11 @@
#ifndef QSURFACEDATAITEM_H
#define QSURFACEDATAITEM_H
-#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qdatavisualizationglobal.h>
+
#include <QVector3D>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurfaceDataItemPrivate;
@@ -54,6 +55,6 @@ private:
QVector3D m_position;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qsurfacedataitem_p.h b/src/datavisualization/data/qsurfacedataitem_p.h
index d13679a8..0cec7eab 100644
--- a/src/datavisualization/data/qsurfacedataitem_p.h
+++ b/src/datavisualization/data/qsurfacedataitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "datavisualizationglobal_p.h"
#include "qsurfacedataitem.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurfaceDataItemPrivate
{
@@ -40,12 +40,10 @@ public:
QSurfaceDataItemPrivate();
virtual ~QSurfaceDataItemPrivate();
- // TODO stores other data for surface items besides position
-
protected:
friend class QSurfaceDataItem;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/qsurfacedataproxy.cpp b/src/datavisualization/data/qsurfacedataproxy.cpp
index 5ea05d75..43ce40eb 100644
--- a/src/datavisualization/data/qsurfacedataproxy.cpp
+++ b/src/datavisualization/data/qsurfacedataproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "qsurfacedataproxy_p.h"
#include "qsurface3dseries_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class QSurfaceDataProxy
@@ -57,6 +57,18 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \typedef QtDataVisualization::QSurfaceDataRow
+ *
+ * A vector of \l {QSurfaceDataItem}s.
+ */
+
+/*!
+ * \typedef QtDataVisualization::QSurfaceDataArray
+ *
+ * A list of pointers to \l {QSurfaceDataRow}s.
+ */
+
+/*!
* \qmltype SurfaceDataProxy
* \inqmlmodule QtDataVisualization
* \since QtDataVisualization 1.0
@@ -343,9 +355,7 @@ const QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptrc() const
* need to emit this signal yourself or the graph won't get updated.
*/
-//
// QSurfaceDataProxyPrivate
-//
QSurfaceDataProxyPrivate::QSurfaceDataProxyPrivate(QSurfaceDataProxy *q)
: QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeSurface),
@@ -520,4 +530,4 @@ void QSurfaceDataProxyPrivate::setSeries(QAbstract3DSeries *series)
emit qptr()->seriesChanged(surfaceSeries);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/qsurfacedataproxy.h b/src/datavisualization/data/qsurfacedataproxy.h
index 04c6dbf7..0933faf6 100644
--- a/src/datavisualization/data/qsurfacedataproxy.h
+++ b/src/datavisualization/data/qsurfacedataproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -22,10 +22,13 @@
#include <QtDataVisualization/qabstractdataproxy.h>
#include <QtDataVisualization/qsurfacedataitem.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
-
+namespace QtDataVisualization {
+// typedefs introduced this way because QDoc doesn't understand namespace macros
typedef QVector<QSurfaceDataItem> QSurfaceDataRow;
typedef QList<QSurfaceDataRow *> QSurfaceDataArray;
+}
+
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurfaceDataProxyPrivate;
class QSurface3DSeries;
@@ -86,6 +89,6 @@ private:
friend class Surface3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QSURFACEDATAPROXY_H
+#endif
diff --git a/src/datavisualization/data/qsurfacedataproxy_p.h b/src/datavisualization/data/qsurfacedataproxy_p.h
index 1fda354c..658abe32 100644
--- a/src/datavisualization/data/qsurfacedataproxy_p.h
+++ b/src/datavisualization/data/qsurfacedataproxy_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -34,7 +34,7 @@
#include <QSize>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class QSurfaceDataProxyPrivate : public QAbstractDataProxyPrivate
{
@@ -67,6 +67,6 @@ private:
friend class QSurfaceDataProxy;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // QSURFACEDATAPROXY_P_H
+#endif
diff --git a/src/datavisualization/data/scatteritemmodelhandler.cpp b/src/datavisualization/data/scatteritemmodelhandler.cpp
index a70b35b0..1c936d08 100644
--- a/src/datavisualization/data/scatteritemmodelhandler.cpp
+++ b/src/datavisualization/data/scatteritemmodelhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,7 +19,9 @@
#include "scatteritemmodelhandler_p.h"
#include <QTimer>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
+
+static const int noRoleIndex = -1;
ScatterItemModelHandler::ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent)
: AbstractItemModelHandler(parent),
@@ -32,6 +34,80 @@ ScatterItemModelHandler::~ScatterItemModelHandler()
{
}
+void ScatterItemModelHandler::handleDataChanged(const QModelIndex &topLeft,
+ const QModelIndex &bottomRight,
+ const QVector<int> &roles)
+{
+ // Do nothing if full reset already pending
+ if (!m_fullReset) {
+ if (m_itemModel->columnCount() > 1) {
+ // If the data model is multi-column, do full asynchronous reset to simplify things
+ AbstractItemModelHandler::handleDataChanged(topLeft, bottomRight, roles);
+ } else {
+ int start = qMin(topLeft.row(), bottomRight.row());
+ int end = qMax(topLeft.row(), bottomRight.row());
+
+ QScatterDataArray array(end - start + 1);
+ int count = 0;
+ for (int i = start; i <= end; i++)
+ modelPosToScatterItem(i, 0, array[count++]);
+
+ m_proxy->setItems(start, array);
+ }
+ }
+}
+
+void ScatterItemModelHandler::handleRowsInserted(const QModelIndex &parent, int start, int end)
+{
+ // Do nothing if full reset already pending
+ if (!m_fullReset) {
+ if (!m_proxy->itemCount() || m_itemModel->columnCount() > 1) {
+ // If inserting into an empty array, do full asynchronous reset to avoid multiple
+ // separate inserts when initializing the model.
+ // If the data model is multi-column, do full asynchronous reset to simplify things
+ AbstractItemModelHandler::handleRowsInserted(parent, start, end);
+ } else {
+ QScatterDataArray array(end - start + 1);
+ int count = 0;
+ for (int i = start; i <= end; i++)
+ modelPosToScatterItem(i, 0, array[count++]);
+
+ m_proxy->insertItems(start, array);
+ }
+ }
+}
+
+void ScatterItemModelHandler::handleRowsRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_UNUSED(parent)
+
+ // Do nothing if full reset already pending
+ if (!m_fullReset) {
+ if (m_itemModel->columnCount() > 1) {
+ // If the data model is multi-column, do full asynchronous reset to simplify things
+ AbstractItemModelHandler::handleRowsRemoved(parent, start, end);
+ } else {
+ m_proxy->removeItems(start, end - start + 1);
+ }
+ }
+}
+
+void ScatterItemModelHandler::modelPosToScatterItem(int modelRow, int modelColumn,
+ QScatterDataItem &item)
+{
+ QModelIndex index = m_itemModel->index(modelRow, modelColumn);
+ float xPos(0.0f);
+ float yPos(0.0f);
+ float zPos(0.0f);
+ if (m_xPosRole != noRoleIndex)
+ xPos = index.data(m_xPosRole).toFloat();
+ if (m_yPosRole != noRoleIndex)
+ yPos = index.data(m_yPosRole).toFloat();
+ if (m_zPosRole != noRoleIndex)
+ zPos = index.data(m_zPosRole).toFloat();
+ item.setPosition(QVector3D(xPos, yPos, zPos));
+}
+
// Resolve entire item model into QScatterDataArray.
void ScatterItemModelHandler::resolveModel()
{
@@ -41,12 +117,10 @@ void ScatterItemModelHandler::resolveModel()
return;
}
- static const int noRoleIndex = -1;
-
QHash<int, QByteArray> roleHash = m_itemModel->roleNames();
- const int xPosRole = roleHash.key(m_proxy->xPosRole().toLatin1(), noRoleIndex);
- const int yPosRole = roleHash.key(m_proxy->yPosRole().toLatin1(), noRoleIndex);
- const int zPosRole = roleHash.key(m_proxy->zPosRole().toLatin1(), noRoleIndex);
+ m_xPosRole = roleHash.key(m_proxy->xPosRole().toLatin1(), noRoleIndex);
+ m_yPosRole = roleHash.key(m_proxy->yPosRole().toLatin1(), noRoleIndex);
+ m_zPosRole = roleHash.key(m_proxy->zPosRole().toLatin1(), noRoleIndex);
const int columnCount = m_itemModel->columnCount();
const int rowCount = m_itemModel->rowCount();
const int totalCount = rowCount * columnCount;
@@ -59,17 +133,7 @@ void ScatterItemModelHandler::resolveModel()
// Parse data into newProxyArray
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
- QModelIndex index = m_itemModel->index(i, j);
- float xPos(0.0f);
- float yPos(0.0f);
- float zPos(0.0f);
- if (xPosRole != noRoleIndex)
- xPos = index.data(xPosRole).toFloat();
- if (yPosRole != noRoleIndex)
- yPos = index.data(yPosRole).toFloat();
- if (zPosRole != noRoleIndex)
- zPos = index.data(zPosRole).toFloat();
- (*m_proxyArray)[runningCount].setPosition(QVector3D(xPos, yPos, zPos));
+ modelPosToScatterItem(i, j, (*m_proxyArray)[runningCount]);
runningCount++;
}
}
@@ -77,4 +141,4 @@ void ScatterItemModelHandler::resolveModel()
m_proxy->resetArray(m_proxyArray);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/scatteritemmodelhandler_p.h b/src/datavisualization/data/scatteritemmodelhandler_p.h
index 72f8f76c..f0e4fa84 100644
--- a/src/datavisualization/data/scatteritemmodelhandler_p.h
+++ b/src/datavisualization/data/scatteritemmodelhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "abstractitemmodelhandler_p.h"
#include "qitemmodelscatterdataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class ScatterItemModelHandler : public AbstractItemModelHandler
{
@@ -41,13 +41,25 @@ public:
ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent = 0);
virtual ~ScatterItemModelHandler();
+public slots:
+ virtual void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
+ const QVector<int> &roles = QVector<int> ());
+ virtual void handleRowsInserted(const QModelIndex &parent, int start, int end);
+ virtual void handleRowsRemoved(const QModelIndex &parent, int start, int end);
+
protected:
void virtual resolveModel();
+private:
+ void modelPosToScatterItem(int modelRow, int modelColumn, QScatterDataItem &item);
+
QItemModelScatterDataProxy *m_proxy; // Not owned
QScatterDataArray *m_proxyArray; // Not owned
+ int m_xPosRole;
+ int m_yPosRole;
+ int m_zPosRole;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/scatterrenderitem.cpp b/src/datavisualization/data/scatterrenderitem.cpp
index 83c66583..d39af816 100644
--- a/src/datavisualization/data/scatterrenderitem.cpp
+++ b/src/datavisualization/data/scatterrenderitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,7 +20,7 @@
#include "scatter3drenderer_p.h"
#include "qscatterdataproxy.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
ScatterRenderItem::ScatterRenderItem()
: AbstractRenderItem(),
@@ -33,10 +33,11 @@ ScatterRenderItem::ScatterRenderItem(const ScatterRenderItem &other)
m_visible(false)
{
m_position = other.m_position;
+ m_rotation = other.m_rotation;
}
ScatterRenderItem::~ScatterRenderItem()
{
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/scatterrenderitem_p.h b/src/datavisualization/data/scatterrenderitem_p.h
index 5a97c1e9..45066dd8 100644
--- a/src/datavisualization/data/scatterrenderitem_p.h
+++ b/src/datavisualization/data/scatterrenderitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -31,7 +31,7 @@
#include "abstractrenderitem_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class Scatter3DRenderer;
@@ -43,35 +43,35 @@ public:
virtual ~ScatterRenderItem();
inline const QVector3D &position() const { return m_position; }
- inline void setPosition(const QVector3D &pos);
+ inline void setPosition(const QVector3D &pos)
+ {
+ if (m_position != pos) {
+ m_position = pos;
+ // Force reformatting on next access by setting label string to null string
+ if (!m_selectionLabel.isNull())
+ setSelectionLabel(QString());
+ }
+ }
+
+ inline QQuaternion rotation() const { return m_rotation; }
+ inline void setRotation(const QQuaternion &rotation)
+ {
+ if (m_rotation != rotation)
+ m_rotation = rotation;
+ }
inline bool isVisible() const { return m_visible; }
inline void setVisible(bool visible) { m_visible = visible; }
- // TODO: Will we ever support item specific size? If not, remove.
- //inline void setSize(float size);
- //inline float size() const { return m_size; }
-
protected:
QVector3D m_position;
+ QQuaternion m_rotation;
bool m_visible;
- //float m_size; // TODO in case we need a fourth variable that adjusts scatter item size
friend class QScatterDataItem;
};
-
-void ScatterRenderItem::setPosition(const QVector3D &pos)
-{
- if (m_position != pos) {
- m_position = pos;
- // Force reformatting on next access by setting label string to null string
- if (!m_selectionLabel.isNull())
- setSelectionLabel(QString());
- }
-}
-
typedef QVector<ScatterRenderItem> ScatterRenderItemArray;
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/data/surfaceitemmodelhandler.cpp b/src/datavisualization/data/surfaceitemmodelhandler.cpp
index 10b4ccc5..767425e9 100644
--- a/src/datavisualization/data/surfaceitemmodelhandler.cpp
+++ b/src/datavisualization/data/surfaceitemmodelhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
#include "surfaceitemmodelhandler_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
SurfaceItemModelHandler::SurfaceItemModelHandler(QItemModelSurfaceDataProxy *proxy, QObject *parent)
: AbstractItemModelHandler(parent),
@@ -131,7 +131,7 @@ void SurfaceItemModelHandler::resolveModel()
for (int j = 0; j < columnList.size(); j++) {
newProxyRow[j].setPosition(QVector3D(columnList.at(j).toFloat(),
itemValueMap[rowKey][columnList.at(j)],
- rowList.at(i).toFloat()));
+ rowList.at(i).toFloat()));
}
}
}
@@ -139,4 +139,4 @@ void SurfaceItemModelHandler::resolveModel()
m_proxy->resetArray(m_proxyArray);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/data/surfaceitemmodelhandler_p.h b/src/datavisualization/data/surfaceitemmodelhandler_p.h
index de0d2885..ae426433 100644
--- a/src/datavisualization/data/surfaceitemmodelhandler_p.h
+++ b/src/datavisualization/data/surfaceitemmodelhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,7 +32,7 @@
#include "abstractitemmodelhandler_p.h"
#include "qitemmodelsurfacedataproxy_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class SurfaceItemModelHandler : public AbstractItemModelHandler
{
@@ -48,6 +48,6 @@ protected:
QSurfaceDataArray *m_proxyArray; // Not owned
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/datavisualization.pro b/src/datavisualization/datavisualization.pro
index 6107eaa6..ff87a2cd 100644
--- a/src/datavisualization/datavisualization.pro
+++ b/src/datavisualization/datavisualization.pro
@@ -4,6 +4,10 @@ TARGET = DataVisualization
QT = core gui
DEFINES += QT_DATAVISUALIZATION_LIBRARY
+
+# Fix exports in static builds for applications linking datavisualization module
+static: MODULE_DEFINES += QT_DATAVISUALIZATION_STATICLIB
+
MODULE_INCNAME = QtDataVisualization
QMAKE_DOCS = $$PWD/doc/qtdatavisualization.qdocconf
diff --git a/src/datavisualization/doc/images/q3dbars-minimal.png b/src/datavisualization/doc/images/q3dbars-minimal.png
index 21dcf5b3..3e94ccae 100644
--- a/src/datavisualization/doc/images/q3dbars-minimal.png
+++ b/src/datavisualization/doc/images/q3dbars-minimal.png
Binary files differ
diff --git a/src/datavisualization/doc/images/q3dscatter-minimal.png b/src/datavisualization/doc/images/q3dscatter-minimal.png
index fc5f8c62..d5f8198c 100644
--- a/src/datavisualization/doc/images/q3dscatter-minimal.png
+++ b/src/datavisualization/doc/images/q3dscatter-minimal.png
Binary files differ
diff --git a/src/datavisualization/doc/images/q3dsurface-minimal.png b/src/datavisualization/doc/images/q3dsurface-minimal.png
index 2ef8b104..af82c9bb 100644
--- a/src/datavisualization/doc/images/q3dsurface-minimal.png
+++ b/src/datavisualization/doc/images/q3dsurface-minimal.png
Binary files differ
diff --git a/src/datavisualization/doc/qtdatavisualization.qdocconf b/src/datavisualization/doc/qtdatavisualization.qdocconf
index 7a7fa0b1..81922313 100644
--- a/src/datavisualization/doc/qtdatavisualization.qdocconf
+++ b/src/datavisualization/doc/qtdatavisualization.qdocconf
@@ -12,8 +12,9 @@ imagedirs += ../images \
images
sourcedirs += ..
-depends += qtcore \
- qtgui
+depends += qtcore qtgui qtdeclarative
+
+indexes += $QTDIR/doc/html/qt.index
qhp.projects = qtdatavisualization
@@ -47,7 +48,7 @@ qhp.qtdatavisualization.subprojects.types.sortPages = true
HTML.footer = \
"<div class=\"footer\">\n" \
" <p>\n" \
- " <acronym title=\"Copyright\">&copy;</acronym> 2013 Digia. Qt and Qt logos are\n" \
+ " <acronym title=\"Copyright\">&copy;</acronym> 2014 Digia. Qt and Qt logos are\n" \
" trademarks of of Digia Corporation in Finland and/or other countries worldwide.\n" \
" </p>\n" \
" All other trademarks are property of their respective owners.\n" \
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp
index 2b4a0aed..64757d58 100644
--- a/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp
index 15820bf1..531ce242 100644
--- a/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp
index 245be2f4..92dd34ed 100644
--- a/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp b/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
index 5a539e62..9a2d1b3d 100644
--- a/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -57,9 +57,9 @@ int main(int argc, char **argv)
//! [3]
Q3DBars *graph = new Q3DBars();
- graph->setTheme(new Q3DTheme(Q3DTheme::ThemePrimaryColors));
- graph->theme()->setBaseColor(Qt::red);
- graph->theme()->setSingleHighlightColor(Qt::yellow);
+ graph->activeTheme()->setType(Q3DTheme::ThemePrimaryColors);
+ graph->activeTheme()->setBaseColor(Qt::red);
+ graph->activeTheme()->setSingleHighlightColor(Qt::yellow);
//! [3]
}
diff --git a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
index 623f7f6f..8c38ca82 100644
--- a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp
index 6a336422..458eeb45 100644
--- a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro
index 81555f88..15ae2f65 100644
--- a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro
+++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/src/qtdatavisualization-index.qdoc b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc
index c37d98a4..d593c1e9 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-index.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,7 +18,7 @@
/*!
\title Qt Data Visualization
- \page qtdatavisualization-index.html
+ \page index.html
\brief Provides functionality for 3D visualization.
Qt Data Visualization module provides a way to visualize data in 3D.
@@ -33,8 +33,7 @@
\li QML2 support
\li Customizable axes for data - control viewable data window with axis ranges
\li Customizable input handling
- \li Customizable scene handling - full control of viewports
- (upcoming feature - not fully supported in alpha)
+ \li Customizable scene handling
\li Customizable themes
\endlist
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
index 7493709f..df503eb4 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -28,6 +28,15 @@
Note that this type is uncreatable, but contains properties that are shared between
the 3D visualizations.
+ \note QML doesn't support the type of anti-aliasing used by Qt Data Visualization graphs
+ by default. Setting the \c antialiasing property doesn't affect graphs. To enable
+ anti-aliasing for graphs, a custom surface format must be set up for the QQuickView
+ before showing it. You can use the convenience function
+ \c{QtDataVisualization::qDefaultSurfaceFormat()} to create the custom surface format object.
+
+ For AbstractGraph3D enums, see \l QAbstract3DGraph::SelectionFlag and
+ \l QAbstract3DGraph::ShadowQuality
+
\sa Bars3D, Scatter3D, Surface3D, {Qt Data Visualization C++ Classes}
*/
@@ -42,11 +51,43 @@
*/
/*!
+ \qmlproperty Scene3D AbstractGraph3D::scene
+ Read only Q3DScene that can be used to access e.g. camera object.
+ */
+
+/*!
\qmlproperty AbstractInputHandler3D AbstractGraph3D::inputHandler
Input handler. You can disable default input handlers by setting this property to \c null.
*/
/*!
\qmlproperty Theme3D AbstractGraph3D::theme
- Theme of the graph.
+ The active theme of the graph.
*/
+
+/*!
+ \qmlproperty bool AbstractGraph3D::clearWindowBeforeRendering
+
+ Indicates if the graph should also clear the whole window before rendering the graph,
+ including the areas outside the graph.
+ Since the graphs are drawn first under other QML items, the regular QML window clearing
+ before rendering is suppressed when there are any graphs in the window; the graphs
+ handle the clearing themselves instead.
+ If you have any other items besides graphs that do similar
+ custom drawing under other QML items, you need to set this property to false on all graphs
+ drawn to same window with the other custom items, or it is likely that the
+ other custom items do not render properly.
+ Defaults to true.
+
+ \note This property should be set to the same value for all graphs in the same window.
+ Otherwise some graphs may not show.
+
+ \note If window clearing before rendering is suppressed, any areas of the window not fully
+ covered with opaque items may not draw properly.
+ */
+
+/*!
+ * \qmlmethod void AbstractGraph3D::clearSelection()
+ * Clears selection from all attached series.
+ */
+
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
index edeb5530..aaafe217 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -46,7 +46,7 @@
/*!
* \qmlproperty CategoryAxis3D Bars3D::rowAxis
- * A user-defined row axis.
+ * The active row axis.
*
* If an axis is not given, a temporary default axis with no labels is created.
* This temporary axis is destroyed if another axis is explicitly set to same orientation.
@@ -54,7 +54,7 @@
/*!
* \qmlproperty ValueAxis3D Bars3D::valueAxis
- * A user-defined value axis.
+ * The active value axis.
*
* If an axis is not given, a temporary default axis with no labels and automatically adjusting
* range is created.
@@ -63,12 +63,18 @@
/*!
* \qmlproperty CategoryAxis3D Bars3D::columnAxis
- * A user-defined column axis.
+ * The active column axis.
*
* If an axis is not given, a temporary default axis with no labels is created.
* This temporary axis is destroyed if another axis is explicitly set to same orientation.
*/
+/*!
+ * \qmlproperty bool Bars3D::multiSeriesUniform
+ * This property controls if bars are to be scaled with proportions set to a single series bar even
+ * if there are multiple series displayed. If set to \c {true}, \l{barSpacing}{bar spacing} will
+ * affect only X-axis correctly. It is preset to \c false by default.
+ */
/*!
* \qmlproperty real Bars3D::barThickness
@@ -87,7 +93,7 @@
*/
/*!
- * \qmlproperty list<QBar3DSeries> Bars3D::seriesList
+ * \qmlproperty list<Bar3DSeries> Bars3D::seriesList
* \default
* This property holds the series of the graph.
* By default, this property contains an empty list.
@@ -95,7 +101,20 @@
*/
/*!
- * \qmlmethod void Bars3D::addSeries(QBar3DSeries *series)
+ * \qmlproperty Bar3DSeries Bars3D::primarySeries
+ * Specifies the \a series that is the primary series of the graph. The primary series
+ * is used to determine the row and column axis labels when the labels are not explicitly
+ * set to the axes.
+ * If the specified \a series is not already added to the graph, setting it as the
+ * primary series will also implicitly add it to the graph.
+ * If the primary series itself is removed from the graph, this property
+ * resets to default.
+ * If \a series is null, this property resets to default.
+ * Defaults to the first added series or zero if no series are added to the graph.
+ */
+
+/*!
+ * \qmlmethod void Bars3D::addSeries(Bar3DSeries series)
* Adds the \a series to the graph. A graph can contain multiple series, but only one set of axes,
* so the rows and columns of all series must match for the visualized data to be meaningful.
* If the graph has multiple visible series, only the first one added will
@@ -105,6 +124,16 @@
*/
/*!
- * \qmlmethod void Bars3D::removeSeries(QBar3DSeries *series)
+ * \qmlmethod void Bars3D::removeSeries(Bar3DSeries series)
* Remove the \a series from the graph.
*/
+
+/*!
+ * \qmlmethod void Bars3D::insertSeries(int index, Bar3DSeries series)
+ * Inserts the \a series into the position \a index in the series list.
+ * If the \a series has already been added to the list, it is moved to the
+ * new \a index.
+ * \note When moving a series to a new \a index that is after its old index,
+ * the new position in list is calculated as if the series was still in its old
+ * index, so the final index is actually the \a index decremented by one.
+ */
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-colorgradient.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-colorgradient.qdoc
index b6f0781f..d0ef5747 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-colorgradient.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-colorgradient.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
index 0a8e1674..b969c536 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -46,7 +46,7 @@
/*!
\qmlproperty ValueAxis3D Scatter3D::axisX
- A user-defined X axis.
+ The active X axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
@@ -55,7 +55,7 @@
/*!
\qmlproperty ValueAxis3D Scatter3D::axisY
- A user-defined Y axis.
+ The active Y axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
@@ -64,7 +64,7 @@
/*!
\qmlproperty ValueAxis3D Scatter3D::axisZ
- A user-defined Z axis.
+ The active Z axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
index b28d30a7..3011336b 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -46,7 +46,7 @@
/*!
\qmlproperty ValueAxis3D Surface3D::axisX
- A user-defined X axis.
+ The active X axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
@@ -55,7 +55,7 @@
/*!
\qmlproperty ValueAxis3D Surface3D::axisY
- A user-defined Y axis.
+ The active Y axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
@@ -64,7 +64,7 @@
/*!
\qmlproperty ValueAxis3D Surface3D::axisZ
- A user-defined Z axis.
+ The active Z axis.
If an axis is not given, a temporary default axis with no labels and automatically adjusting
range is created.
diff --git a/src/datavisualization/doc/src/qtdatavisualization.qdoc b/src/datavisualization/doc/src/qtdatavisualization.qdoc
index 9c951877..c85b9dbb 100644
--- a/src/datavisualization/doc/src/qtdatavisualization.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,6 +17,16 @@
****************************************************************************/
/*!
+ \namespace QtDataVisualization
+ \inmodule QtDataVisualization
+
+ QtDataVisualization namespace holds all the classes and enumerations in the QtDataVisualization
+ module.
+
+ \generatelist{classesbymodule QtDataVisualization}
+*/
+
+/*!
\module QtDataVisualization
\title Qt Data Visualization C++ Classes
\ingroup modules
@@ -286,3 +296,29 @@
When multiple series are added to a graph, selecting an item in one of them will clear the selection
on other series.
*/
+
+/*!
+ * \fn QSurfaceFormat QtDataVisualization::qDefaultSurfaceFormat(bool antialias = true)
+ * \relates QAbstract3DGraph
+ *
+ * Anti-aliasing is turned on by default on C++ and turned off on QML, except in OpenGL ES2
+ * environments, where anti-aliasing is not supported by Qt Data Visualization.
+ * This convenience function can be used to construct a suitable surface format for use by
+ * Qt Data Visualization graphs.
+ * The \a{antialias} parameter specifies whether or not anti-aliasing is activated.
+ * Give the surface format returned by this function to the graph constructor (C++) or set
+ * it as the window format for QQuickView (QML) before calling show on it.
+ *
+ * For example, disable anti-aliasing on C++ application:
+ *
+ * \code
+ * Q3DBars *graph = new Q3DBars(QtDataVisualization::qDefaultSurfaceFormat(false));
+ * \endcode
+ *
+ * For example, enable anti-aliasing on QML application:
+ *
+ * \code
+ * QtQuick2ApplicationViewer viewer;
+ * viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat());
+ * \endcode
+ */
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index 9835dbe4..4989ddb5 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -18,9 +18,9 @@
#include "abstract3dcontroller_p.h"
#include "camerahelper_p.h"
-#include "q3dabstractaxis_p.h"
-#include "q3dvalueaxis.h"
-#include "q3dcategoryaxis.h"
+#include "qabstract3daxis_p.h"
+#include "qvalue3daxis.h"
+#include "qcategory3daxis.h"
#include "abstract3drenderer_p.h"
#include "q3dcamera.h"
#include "q3dlight.h"
@@ -29,18 +29,21 @@
#include "qtouch3dinputhandler.h"
#include "qabstract3dseries_p.h"
#include "thememanager_p.h"
+#include "q3dtheme_p.h"
#include "q3dscene_p.h"
+#include "q3dscene.h"
#include <QThread>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-Abstract3DController::Abstract3DController(QRect initialViewport, QObject *parent) :
+Abstract3DController::Abstract3DController(QRect initialViewport, Q3DScene *scene,
+ QObject *parent) :
QObject(parent),
m_themeManager(new ThemeManager(this)),
- m_selectionMode(QDataVis::SelectionItem),
- m_shadowQuality(QDataVis::ShadowQualityMedium),
- m_scene(new Q3DScene()),
+ m_selectionMode(QAbstract3DGraph::SelectionItem),
+ m_shadowQuality(QAbstract3DGraph::ShadowQualityMedium),
+ m_scene(scene),
m_activeInputHandler(0),
m_axisX(0),
m_axisY(0),
@@ -51,8 +54,13 @@ Abstract3DController::Abstract3DController(QRect initialViewport, QObject *paren
m_isSeriesVisualsDirty(true),
m_renderPending(false)
{
+ if (!m_scene)
+ m_scene = new Q3DScene;
+
// Set initial theme
- setTheme(new Q3DTheme(Q3DTheme::ThemeQt));
+ Q3DTheme *defaultTheme = new Q3DTheme(Q3DTheme::ThemeQt);
+ defaultTheme->d_ptr->setDefaultTheme(true);
+ setActiveTheme(defaultTheme);
m_scene->d_ptr->setViewport(initialViewport);
@@ -64,8 +72,8 @@ Abstract3DController::Abstract3DController(QRect initialViewport, QObject *paren
inputHandler = new QTouch3DInputHandler();
inputHandler->d_ptr->m_isDefaultHandler = true;
setActiveInputHandler(inputHandler);
- connect(inputHandler, &QAbstract3DInputHandler::inputStateChanged, this,
- &Abstract3DController::handleInputStateChanged);
+ connect(inputHandler, &QAbstract3DInputHandler::inputViewChanged, this,
+ &Abstract3DController::handleInputViewChanged);
connect(inputHandler, &QAbstract3DInputHandler::positionChanged, this,
&Abstract3DController::handleInputPositionChanged);
connect(m_scene->d_ptr.data(), &Q3DScenePrivate::needRender, this,
@@ -94,15 +102,30 @@ void Abstract3DController::setRenderer(Abstract3DRenderer *renderer)
void Abstract3DController::addSeries(QAbstract3DSeries *series)
{
- if (series && !m_seriesList.contains(series)) {
- int oldSize = m_seriesList.size();
- m_seriesList.append(series);
- series->d_ptr->setController(this);
- QObject::connect(series, &QAbstract3DSeries::visibilityChanged,
- this, &Abstract3DController::handleSeriesVisibilityChanged);
+ insertSeries(m_seriesList.size(), series);
+}
+
+void Abstract3DController::insertSeries(int index, QAbstract3DSeries *series)
+{
+ if (series) {
+ if (m_seriesList.contains(series)) {
+ int oldIndex = m_seriesList.indexOf(series);
+ if (index != oldIndex) {
+ m_seriesList.removeOne(series);
+ if (oldIndex < index)
+ index--;
+ m_seriesList.insert(index, series);
+ }
+ } else {
+ int oldSize = m_seriesList.size();
+ m_seriesList.insert(index, series);
+ series->d_ptr->setController(this);
+ QObject::connect(series, &QAbstract3DSeries::visibilityChanged,
+ this, &Abstract3DController::handleSeriesVisibilityChanged);
+ series->d_ptr->resetToTheme(*m_themeManager->activeTheme(), oldSize, false);
+ }
if (series->isVisible())
handleSeriesVisibilityChangedBySender(series);
- series->d_ptr->resetToTheme(*m_themeManager->theme(), oldSize, false);
}
}
@@ -129,13 +152,20 @@ QList<QAbstract3DSeries *> Abstract3DController::seriesList()
*/
void Abstract3DController::synchDataToRenderer()
{
- // If we don't have a renderer, don't do anything
- if (!m_renderer)
- return;
+ // Subclass implementations check for renderer validity already, so no need to check here.
+
+ // If there is a pending click from renderer, handle that first.
+ if (m_renderer->isClickPending()) {
+ handlePendingClick();
+ m_renderer->clearClickPending();
+ }
+
+ startRecordingRemovesAndInserts();
- m_renderer->updateScene(m_scene);
+ if (m_scene->d_ptr->m_sceneDirty)
+ m_renderer->updateScene(m_scene);
- m_renderer->updateTheme(m_themeManager->theme());
+ m_renderer->updateTheme(m_themeManager->activeTheme());
if (m_changeTracker.shadowQualityChanged) {
m_renderer->updateShadowQuality(m_shadowQuality);
@@ -148,144 +178,144 @@ void Abstract3DController::synchDataToRenderer()
}
if (m_changeTracker.axisXTypeChanged) {
- m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationX, m_axisX->type());
+ m_renderer->updateAxisType(QAbstract3DAxis::AxisOrientationX, m_axisX->type());
m_changeTracker.axisXTypeChanged = false;
}
if (m_changeTracker.axisYTypeChanged) {
- m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationY, m_axisY->type());
+ m_renderer->updateAxisType(QAbstract3DAxis::AxisOrientationY, m_axisY->type());
m_changeTracker.axisYTypeChanged = false;
}
if (m_changeTracker.axisZTypeChanged) {
- m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->type());
+ m_renderer->updateAxisType(QAbstract3DAxis::AxisOrientationZ, m_axisZ->type());
m_changeTracker.axisZTypeChanged = false;
}
if (m_changeTracker.axisXTitleChanged) {
- m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationX, m_axisX->title());
+ m_renderer->updateAxisTitle(QAbstract3DAxis::AxisOrientationX, m_axisX->title());
m_changeTracker.axisXTitleChanged = false;
}
if (m_changeTracker.axisYTitleChanged) {
- m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationY, m_axisY->title());
+ m_renderer->updateAxisTitle(QAbstract3DAxis::AxisOrientationY, m_axisY->title());
m_changeTracker.axisYTitleChanged = false;
}
if (m_changeTracker.axisZTitleChanged) {
- m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->title());
+ m_renderer->updateAxisTitle(QAbstract3DAxis::AxisOrientationZ, m_axisZ->title());
m_changeTracker.axisZTitleChanged = false;
}
if (m_changeTracker.axisXLabelsChanged) {
- m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationX, m_axisX->labels());
+ m_renderer->updateAxisLabels(QAbstract3DAxis::AxisOrientationX, m_axisX->labels());
m_changeTracker.axisXLabelsChanged = false;
}
if (m_changeTracker.axisYLabelsChanged) {
- m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationY, m_axisY->labels());
+ m_renderer->updateAxisLabels(QAbstract3DAxis::AxisOrientationY, m_axisY->labels());
m_changeTracker.axisYLabelsChanged = false;
}
if (m_changeTracker.axisZLabelsChanged) {
- m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->labels());
+ m_renderer->updateAxisLabels(QAbstract3DAxis::AxisOrientationZ, m_axisZ->labels());
m_changeTracker.axisZLabelsChanged = false;
}
if (m_changeTracker.axisXRangeChanged) {
- m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationX, m_axisX->min(),
+ m_renderer->updateAxisRange(QAbstract3DAxis::AxisOrientationX, m_axisX->min(),
m_axisX->max());
m_changeTracker.axisXRangeChanged = false;
}
if (m_changeTracker.axisYRangeChanged) {
- m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationY, m_axisY->min(),
+ m_renderer->updateAxisRange(QAbstract3DAxis::AxisOrientationY, m_axisY->min(),
m_axisY->max());
m_changeTracker.axisYRangeChanged = false;
}
if (m_changeTracker.axisZRangeChanged) {
- m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->min(),
+ m_renderer->updateAxisRange(QAbstract3DAxis::AxisOrientationZ, m_axisZ->min(),
m_axisZ->max());
m_changeTracker.axisZRangeChanged = false;
}
if (m_changeTracker.axisXSegmentCountChanged) {
m_changeTracker.axisXSegmentCountChanged = false;
- if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
- m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationX,
+ if (m_axisX->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisX = static_cast<QValue3DAxis *>(m_axisX);
+ m_renderer->updateAxisSegmentCount(QAbstract3DAxis::AxisOrientationX,
valueAxisX->segmentCount());
}
}
if (m_changeTracker.axisYSegmentCountChanged) {
m_changeTracker.axisYSegmentCountChanged = false;
- if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
- m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationY,
+ if (m_axisY->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisY = static_cast<QValue3DAxis *>(m_axisY);
+ m_renderer->updateAxisSegmentCount(QAbstract3DAxis::AxisOrientationY,
valueAxisY->segmentCount());
}
}
if (m_changeTracker.axisZSegmentCountChanged) {
m_changeTracker.axisZSegmentCountChanged = false;
- if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
- m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationZ,
+ if (m_axisZ->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisZ = static_cast<QValue3DAxis *>(m_axisZ);
+ m_renderer->updateAxisSegmentCount(QAbstract3DAxis::AxisOrientationZ,
valueAxisZ->segmentCount());
}
}
if (m_changeTracker.axisXSubSegmentCountChanged) {
m_changeTracker.axisXSubSegmentCountChanged = false;
- if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
- m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationX,
+ if (m_axisX->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisX = static_cast<QValue3DAxis *>(m_axisX);
+ m_renderer->updateAxisSubSegmentCount(QAbstract3DAxis::AxisOrientationX,
valueAxisX->subSegmentCount());
}
}
if (m_changeTracker.axisYSubSegmentCountChanged) {
m_changeTracker.axisYSubSegmentCountChanged = false;
- if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
- m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationY,
+ if (m_axisY->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisY = static_cast<QValue3DAxis *>(m_axisY);
+ m_renderer->updateAxisSubSegmentCount(QAbstract3DAxis::AxisOrientationY,
valueAxisY->subSegmentCount());
}
}
if (m_changeTracker.axisZSubSegmentCountChanged) {
m_changeTracker.axisZSubSegmentCountChanged = false;
- if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
- m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationZ,
+ if (m_axisZ->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisZ = static_cast<QValue3DAxis *>(m_axisZ);
+ m_renderer->updateAxisSubSegmentCount(QAbstract3DAxis::AxisOrientationZ,
valueAxisZ->subSegmentCount());
}
}
if (m_changeTracker.axisXLabelFormatChanged) {
m_changeTracker.axisXLabelFormatChanged = false;
- if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
- m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationX,
+ if (m_axisX->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisX = static_cast<QValue3DAxis *>(m_axisX);
+ m_renderer->updateAxisLabelFormat(QAbstract3DAxis::AxisOrientationX,
valueAxisX->labelFormat());
}
}
if (m_changeTracker.axisYLabelFormatChanged) {
m_changeTracker.axisYLabelFormatChanged = false;
- if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
- m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationY,
+ if (m_axisY->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisY = static_cast<QValue3DAxis *>(m_axisY);
+ m_renderer->updateAxisLabelFormat(QAbstract3DAxis::AxisOrientationY,
valueAxisY->labelFormat());
}
}
if (m_changeTracker.axisZLabelFormatChanged) {
m_changeTracker.axisZLabelFormatChanged = false;
- if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
- m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationZ,
+ if (m_axisZ->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxisZ = static_cast<QValue3DAxis *>(m_axisZ);
+ m_renderer->updateAxisLabelFormat(QAbstract3DAxis::AxisOrientationZ,
valueAxisZ->labelFormat());
}
}
@@ -446,37 +476,62 @@ void Abstract3DController::handleThemeMultiHighlightGradientChanged(const QLinea
markSeriesVisualsDirty();
}
-void Abstract3DController::setAxisX(Q3DAbstractAxis *axis)
+void Abstract3DController::handleThemeTypeChanged(Q3DTheme::Theme theme)
{
- setAxisHelper(Q3DAbstractAxis::AxisOrientationX, axis, &m_axisX);
+ Q_UNUSED(theme)
+
+ // Changing theme type is logically equivalent of changing the entire theme
+ // object, so reset all attached series to the new theme.
+
+ Q3DTheme *activeTheme = m_themeManager->activeTheme();
+ for (int i = 0; i < m_seriesList.size(); i++)
+ m_seriesList.at(i)->d_ptr->resetToTheme(*activeTheme, i, true);
+ markSeriesVisualsDirty();
+}
+
+void Abstract3DController::setAxisX(QAbstract3DAxis *axis)
+{
+ // Setting null axis will always create new default axis
+ if (!axis || axis != m_axisX) {
+ setAxisHelper(QAbstract3DAxis::AxisOrientationX, axis, &m_axisX);
+ emit axisXChanged(m_axisX);
+ }
}
-Q3DAbstractAxis *Abstract3DController::axisX()
+QAbstract3DAxis *Abstract3DController::axisX()
{
return m_axisX;
}
-void Abstract3DController::setAxisY(Q3DAbstractAxis *axis)
+void Abstract3DController::setAxisY(QAbstract3DAxis *axis)
{
- setAxisHelper(Q3DAbstractAxis::AxisOrientationY, axis, &m_axisY);
+ // Setting null axis will always create new default axis
+ if (!axis || axis != m_axisY) {
+ setAxisHelper(QAbstract3DAxis::AxisOrientationY, axis, &m_axisY);
+ emit axisYChanged(m_axisY);
+ }
}
-Q3DAbstractAxis *Abstract3DController::axisY()
+QAbstract3DAxis *Abstract3DController::axisY()
{
return m_axisY;
}
-void Abstract3DController::setAxisZ(Q3DAbstractAxis *axis)
+void Abstract3DController::setAxisZ(QAbstract3DAxis *axis)
{
- setAxisHelper(Q3DAbstractAxis::AxisOrientationZ, axis, &m_axisZ);
+ // Setting null axis will always create new default axis
+ if (!axis || axis != m_axisZ) {
+ setAxisHelper(QAbstract3DAxis::AxisOrientationZ, axis, &m_axisZ);
+ emit axisZChanged(m_axisZ);
+ }
}
-Q3DAbstractAxis *Abstract3DController::axisZ()
+QAbstract3DAxis *Abstract3DController::axisZ()
{
return m_axisZ;
}
-void Abstract3DController::addAxis(Q3DAbstractAxis *axis)
+void Abstract3DController::addAxis(QAbstract3DAxis *axis)
{
Q_ASSERT(axis);
Abstract3DController *owner = qobject_cast<Abstract3DController *>(axis->parent());
@@ -488,7 +543,7 @@ void Abstract3DController::addAxis(Q3DAbstractAxis *axis)
m_axes.append(axis);
}
-void Abstract3DController::releaseAxis(Q3DAbstractAxis *axis)
+void Abstract3DController::releaseAxis(QAbstract3DAxis *axis)
{
if (axis && m_axes.contains(axis)) {
// Clear the default status from released default axes
@@ -497,13 +552,13 @@ void Abstract3DController::releaseAxis(Q3DAbstractAxis *axis)
// If the axis is in use, replace it with a temporary one
switch (axis->orientation()) {
- case Q3DAbstractAxis::AxisOrientationX:
+ case QAbstract3DAxis::AxisOrientationX:
setAxisX(0);
break;
- case Q3DAbstractAxis::AxisOrientationY:
+ case QAbstract3DAxis::AxisOrientationY:
setAxisY(0);
break;
- case Q3DAbstractAxis::AxisOrientationZ:
+ case QAbstract3DAxis::AxisOrientationZ:
setAxisZ(0);
break;
default:
@@ -515,7 +570,7 @@ void Abstract3DController::releaseAxis(Q3DAbstractAxis *axis)
}
}
-QList<Q3DAbstractAxis *> Abstract3DController::axes() const
+QList<QAbstract3DAxis *> Abstract3DController::axes() const
{
return m_axes;
}
@@ -525,7 +580,8 @@ void Abstract3DController::addInputHandler(QAbstract3DInputHandler *inputHandler
Q_ASSERT(inputHandler);
Abstract3DController *owner = qobject_cast<Abstract3DController *>(inputHandler->parent());
if (owner != this) {
- Q_ASSERT_X(!owner, "addInputHandler", "Input handler already attached to another component.");
+ Q_ASSERT_X(!owner, "addInputHandler",
+ "Input handler already attached to another component.");
inputHandler->setParent(this);
}
@@ -582,6 +638,11 @@ QAbstract3DInputHandler* Abstract3DController::activeInputHandler()
return m_activeInputHandler;
}
+QList<QAbstract3DInputHandler *> Abstract3DController::inputHandlers() const
+{
+ return m_inputHandlers;
+}
+
int Abstract3DController::zoomLevel()
{
return m_scene->activeCamera()->zoomLevel();
@@ -595,25 +656,46 @@ void Abstract3DController::setZoomLevel(int zoomLevel)
emitNeedRender();
}
-void Abstract3DController::setTheme(Q3DTheme *theme)
+void Abstract3DController::addTheme(Q3DTheme *theme)
+{
+ m_themeManager->addTheme(theme);
+}
+
+void Abstract3DController::releaseTheme(Q3DTheme *theme)
+{
+ Q3DTheme *oldTheme = m_themeManager->activeTheme();
+
+ m_themeManager->releaseTheme(theme);
+
+ if (oldTheme != m_themeManager->activeTheme())
+ emit activeThemeChanged(m_themeManager->activeTheme());
+}
+QList<Q3DTheme *> Abstract3DController::themes() const
+{
+ return m_themeManager->themes();
+}
+
+void Abstract3DController::setActiveTheme(Q3DTheme *theme)
{
- if (theme != m_themeManager->theme()) {
- m_themeManager->setTheme(theme);
+ if (theme != m_themeManager->activeTheme()) {
+ m_themeManager->setActiveTheme(theme);
m_changeTracker.themeChanged = true;
+ // Default theme can be created by theme manager, so ensure we have correct theme
+ Q3DTheme *newActiveTheme = m_themeManager->activeTheme();
// Reset all attached series to the new theme
for (int i = 0; i < m_seriesList.size(); i++)
- m_seriesList.at(i)->d_ptr->resetToTheme(*theme, i, true);
+ m_seriesList.at(i)->d_ptr->resetToTheme(*newActiveTheme, i, true);
markSeriesVisualsDirty();
- emit themeChanged(theme);
+ emit activeThemeChanged(newActiveTheme);
}
}
-Q3DTheme *Abstract3DController::theme() const
+Q3DTheme *Abstract3DController::activeTheme() const
{
- return m_themeManager->theme();
+ return m_themeManager->activeTheme();
}
-void Abstract3DController::setSelectionMode(QDataVis::SelectionFlags mode)
+void Abstract3DController::setSelectionMode(QAbstract3DGraph::SelectionFlags mode)
{
if (mode != m_selectionMode) {
m_selectionMode = mode;
@@ -623,12 +705,12 @@ void Abstract3DController::setSelectionMode(QDataVis::SelectionFlags mode)
}
}
-QDataVis::SelectionFlags Abstract3DController::selectionMode() const
+QAbstract3DGraph::SelectionFlags Abstract3DController::selectionMode() const
{
return m_selectionMode;
}
-void Abstract3DController::setShadowQuality(QDataVis::ShadowQuality quality)
+void Abstract3DController::setShadowQuality(QAbstract3DGraph::ShadowQuality quality)
{
if (quality != m_shadowQuality) {
m_shadowQuality = quality;
@@ -638,7 +720,7 @@ void Abstract3DController::setShadowQuality(QDataVis::ShadowQuality quality)
}
}
-QDataVis::ShadowQuality Abstract3DController::shadowQuality() const
+QAbstract3DGraph::ShadowQuality Abstract3DController::shadowQuality() const
{
return m_shadowQuality;
}
@@ -776,7 +858,7 @@ void Abstract3DController::handleAxisAutoAdjustRangeChanged(bool autoAdjust)
if (sender != m_axisX && sender != m_axisY && sender != m_axisZ)
return;
- Q3DAbstractAxis *axis = static_cast<Q3DAbstractAxis*>(sender);
+ QAbstract3DAxis *axis = static_cast<QAbstract3DAxis*>(sender);
handleAxisAutoAdjustRangeChangedInOrientation(axis->orientation(), autoAdjust);
}
@@ -786,15 +868,15 @@ void Abstract3DController::handleAxisLabelFormatChanged(const QString &format)
handleAxisLabelFormatChangedBySender(sender());
}
-void Abstract3DController::handleInputStateChanged(QAbstract3DInputHandler::InputState state)
+void Abstract3DController::handleInputViewChanged(QAbstract3DInputHandler::InputView view)
{
- // When in automatic slicing mode, input state change to overview disables slice mode
- if (m_selectionMode.testFlag(QDataVis::SelectionSlice)
- && state == QAbstract3DInputHandler::InputStateOnPrimaryView) {
+ // When in automatic slicing mode, input view change to primary disables slice mode
+ if (m_selectionMode.testFlag(QAbstract3DGraph::SelectionSlice)
+ && view == QAbstract3DInputHandler::InputViewOnPrimary) {
setSlicingActive(false);
}
- m_changeTracker.inputStateChanged = true;
+ m_changeTracker.inputViewChanged = true;
emitNeedRender();
}
@@ -813,7 +895,7 @@ void Abstract3DController::handleSeriesVisibilityChanged(bool visible)
handleSeriesVisibilityChangedBySender(sender());
}
-void Abstract3DController::handleRequestShadowQuality(QDataVis::ShadowQuality quality)
+void Abstract3DController::handleRequestShadowQuality(QAbstract3DGraph::ShadowQuality quality)
{
setShadowQuality(quality);
}
@@ -845,15 +927,15 @@ void Abstract3DController::handleSeriesVisibilityChangedBySender(QObject *sender
emitNeedRender();
}
-void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orientation,
- Q3DAbstractAxis *axis, Q3DAbstractAxis **axisPtr)
+void Abstract3DController::setAxisHelper(QAbstract3DAxis::AxisOrientation orientation,
+ QAbstract3DAxis *axis, QAbstract3DAxis **axisPtr)
{
// Setting null axis indicates using default axis
if (!axis)
axis = createDefaultAxis(orientation);
// If old axis is default axis, delete it
- Q3DAbstractAxis *oldAxis = *axisPtr;
+ QAbstract3DAxis *oldAxis = *axisPtr;
if (oldAxis) {
if (oldAxis->d_ptr->isDefaultAxis()) {
m_axes.removeAll(oldAxis);
@@ -862,7 +944,7 @@ void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orient
} else {
// Disconnect the old axis from use
QObject::disconnect(oldAxis, 0, this, 0);
- oldAxis->d_ptr->setOrientation(Q3DAbstractAxis::AxisOrientationNone);
+ oldAxis->d_ptr->setOrientation(QAbstract3DAxis::AxisOrientationNone);
}
}
@@ -874,20 +956,20 @@ void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orient
axis->d_ptr->setOrientation(orientation);
- QObject::connect(axis, &Q3DAbstractAxis::titleChanged,
+ QObject::connect(axis, &QAbstract3DAxis::titleChanged,
this, &Abstract3DController::handleAxisTitleChanged);
- QObject::connect(axis, &Q3DAbstractAxis::labelsChanged,
+ QObject::connect(axis, &QAbstract3DAxis::labelsChanged,
this, &Abstract3DController::handleAxisLabelsChanged);
- QObject::connect(axis, &Q3DAbstractAxis::rangeChanged,
+ QObject::connect(axis, &QAbstract3DAxis::rangeChanged,
this, &Abstract3DController::handleAxisRangeChanged);
- QObject::connect(axis, &Q3DAbstractAxis::autoAdjustRangeChanged,
+ QObject::connect(axis, &QAbstract3DAxis::autoAdjustRangeChanged,
this, &Abstract3DController::handleAxisAutoAdjustRangeChanged);
- if (orientation == Q3DAbstractAxis::AxisOrientationX)
+ if (orientation == QAbstract3DAxis::AxisOrientationX)
m_changeTracker.axisXTypeChanged = true;
- else if (orientation == Q3DAbstractAxis::AxisOrientationY)
+ else if (orientation == QAbstract3DAxis::AxisOrientationY)
m_changeTracker.axisYTypeChanged = true;
- else if (orientation == Q3DAbstractAxis::AxisOrientationZ)
+ else if (orientation == QAbstract3DAxis::AxisOrientationZ)
m_changeTracker.axisZTypeChanged = true;
handleAxisTitleChangedBySender(axis);
@@ -896,13 +978,13 @@ void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orient
handleAxisAutoAdjustRangeChangedInOrientation(axis->orientation(),
axis->isAutoAdjustRange());
- if (axis->type() & Q3DAbstractAxis::AxisTypeValue) {
- Q3DValueAxis *valueAxis = static_cast<Q3DValueAxis *>(axis);
- QObject::connect(valueAxis, &Q3DValueAxis::segmentCountChanged,
+ if (axis->type() & QAbstract3DAxis::AxisTypeValue) {
+ QValue3DAxis *valueAxis = static_cast<QValue3DAxis *>(axis);
+ QObject::connect(valueAxis, &QValue3DAxis::segmentCountChanged,
this, &Abstract3DController::handleAxisSegmentCountChanged);
- QObject::connect(valueAxis, &Q3DValueAxis::subSegmentCountChanged,
+ QObject::connect(valueAxis, &QValue3DAxis::subSegmentCountChanged,
this, &Abstract3DController::handleAxisSubSegmentCountChanged);
- QObject::connect(valueAxis, &Q3DValueAxis::labelFormatChanged,
+ QObject::connect(valueAxis, &QValue3DAxis::labelFormatChanged,
this, &Abstract3DController::handleAxisLabelFormatChanged);
handleAxisSegmentCountChangedBySender(valueAxis);
@@ -911,33 +993,38 @@ void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orient
}
}
-Q3DAbstractAxis *Abstract3DController::createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation)
+QAbstract3DAxis *Abstract3DController::createDefaultAxis(QAbstract3DAxis::AxisOrientation orientation)
{
Q_UNUSED(orientation)
// The default default axis is a value axis. If the graph type has a different default axis
// for some orientation, this function needs to be overridden.
- Q3DAbstractAxis *defaultAxis = createDefaultValueAxis();
+ QAbstract3DAxis *defaultAxis = createDefaultValueAxis();
return defaultAxis;
}
-Q3DValueAxis *Abstract3DController::createDefaultValueAxis()
+QValue3DAxis *Abstract3DController::createDefaultValueAxis()
{
// Default value axis has single segment, empty label format, and auto scaling
- Q3DValueAxis *defaultAxis = new Q3DValueAxis;
+ QValue3DAxis *defaultAxis = new QValue3DAxis;
defaultAxis->d_ptr->setDefaultAxis(true);
return defaultAxis;
}
-Q3DCategoryAxis *Abstract3DController::createDefaultCategoryAxis()
+QCategory3DAxis *Abstract3DController::createDefaultCategoryAxis()
{
// Default category axis has no labels
- Q3DCategoryAxis *defaultAxis = new Q3DCategoryAxis;
+ QCategory3DAxis *defaultAxis = new QCategory3DAxis;
defaultAxis->d_ptr->setDefaultAxis(true);
return defaultAxis;
}
+void Abstract3DController::startRecordingRemovesAndInserts()
+{
+ // Default implementation does nothing
+}
+
void Abstract3DController::emitNeedRender()
{
if (!m_renderPending) {
@@ -946,4 +1033,4 @@ void Abstract3DController::emitNeedRender()
}
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
index c56b8a72..cac46ddf 100644
--- a/src/datavisualization/engine/abstract3dcontroller_p.h
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -30,7 +30,7 @@
#define ABSTRACT3DCONTROLLER_P_H
#include "datavisualizationglobal_p.h"
-#include "q3dabstractaxis.h"
+#include "qabstract3daxis.h"
#include "drawer_p.h"
#include "qabstract3dinputhandler.h"
#include "qabstractdataproxy.h"
@@ -42,7 +42,7 @@
class QFont;
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class CameraHelper;
class Abstract3DRenderer;
@@ -76,7 +76,7 @@ struct Abstract3DChangeBitField {
bool axisXLabelFormatChanged : 1;
bool axisYLabelFormatChanged : 1;
bool axisZLabelFormatChanged : 1;
- bool inputStateChanged : 1;
+ bool inputViewChanged : 1;
bool inputPositionChanged : 1;
Abstract3DChangeBitField() :
@@ -136,20 +136,20 @@ private:
GLfloat m_horizontalRotation;
GLfloat m_verticalRotation;
ThemeManager *m_themeManager;
- QDataVis::SelectionFlags m_selectionMode;
- QDataVis::ShadowQuality m_shadowQuality;
- Q3DScene *m_scene;
+ QAbstract3DGraph::SelectionFlags m_selectionMode;
+ QAbstract3DGraph::ShadowQuality m_shadowQuality;
protected:
+ Q3DScene *m_scene;
QList<QAbstract3DInputHandler *> m_inputHandlers; // List of all added input handlers
QAbstract3DInputHandler *m_activeInputHandler;
CameraHelper *m_cameraHelper;
// Active axes
- Q3DAbstractAxis *m_axisX;
- Q3DAbstractAxis *m_axisY;
- Q3DAbstractAxis *m_axisZ;
+ QAbstract3DAxis *m_axisX;
+ QAbstract3DAxis *m_axisY;
+ QAbstract3DAxis *m_axisZ;
- QList<Q3DAbstractAxis *> m_axes; // List of all added axes
+ QList<QAbstract3DAxis *> m_axes; // List of all added axes
Abstract3DRenderer *m_renderer;
bool m_isDataDirty;
bool m_isSeriesVisibilityDirty;
@@ -158,10 +158,10 @@ protected:
QList<QAbstract3DSeries *> m_seriesList;
- explicit Abstract3DController(QRect initialViewport, QObject *parent = 0);
- virtual ~Abstract3DController();
+ explicit Abstract3DController(QRect initialViewport, Q3DScene *scene, QObject *parent = 0);
public:
+ virtual ~Abstract3DController();
inline bool isInitialized() { return (m_renderer != 0); }
virtual void synchDataToRenderer();
@@ -170,35 +170,40 @@ public:
void setRenderer(Abstract3DRenderer *renderer);
virtual void addSeries(QAbstract3DSeries *series);
+ virtual void insertSeries(int index, QAbstract3DSeries *series);
virtual void removeSeries(QAbstract3DSeries *series);
QList<QAbstract3DSeries *> seriesList();
- virtual void setAxisX(Q3DAbstractAxis *axis);
- virtual Q3DAbstractAxis *axisX();
- virtual void setAxisY(Q3DAbstractAxis *axis);
- virtual Q3DAbstractAxis *axisY();
- virtual void setAxisZ(Q3DAbstractAxis *axis);
- virtual Q3DAbstractAxis *axisZ();
- virtual void addAxis(Q3DAbstractAxis *axis);
- virtual void releaseAxis(Q3DAbstractAxis *axis);
- virtual QList<Q3DAbstractAxis *> axes() const; // Omits default axes
+ virtual void setAxisX(QAbstract3DAxis *axis);
+ virtual QAbstract3DAxis *axisX();
+ virtual void setAxisY(QAbstract3DAxis *axis);
+ virtual QAbstract3DAxis *axisY();
+ virtual void setAxisZ(QAbstract3DAxis *axis);
+ virtual QAbstract3DAxis *axisZ();
+ virtual void addAxis(QAbstract3DAxis *axis);
+ virtual void releaseAxis(QAbstract3DAxis *axis);
+ virtual QList<QAbstract3DAxis *> axes() const; // Omits default axes
virtual void addInputHandler(QAbstract3DInputHandler *inputHandler);
virtual void releaseInputHandler(QAbstract3DInputHandler *inputHandler);
virtual void setActiveInputHandler(QAbstract3DInputHandler *inputHandler);
virtual QAbstract3DInputHandler *activeInputHandler();
+ virtual QList<QAbstract3DInputHandler *> inputHandlers() const;
virtual int zoomLevel();
virtual void setZoomLevel(int zoomLevel);
- virtual void setTheme(Q3DTheme *theme);
- virtual Q3DTheme *theme() const;
+ virtual void addTheme(Q3DTheme *theme);
+ virtual void releaseTheme(Q3DTheme *theme);
+ virtual void setActiveTheme(Q3DTheme *theme);
+ virtual Q3DTheme *activeTheme() const;
+ virtual QList<Q3DTheme *> themes() const;
- virtual void setSelectionMode(QDataVis::SelectionFlags mode);
- virtual QDataVis::SelectionFlags selectionMode() const;
+ virtual void setSelectionMode(QAbstract3DGraph::SelectionFlags mode);
+ virtual QAbstract3DGraph::SelectionFlags selectionMode() const;
- virtual void setShadowQuality(QDataVis::ShadowQuality quality);
- virtual QDataVis::ShadowQuality shadowQuality() const;
+ virtual void setShadowQuality(QAbstract3DGraph::ShadowQuality quality);
+ virtual QAbstract3DGraph::ShadowQuality shadowQuality() const;
bool isSlicingActive() const;
void setSlicingActive(bool isSlicing);
@@ -210,6 +215,8 @@ public:
void emitNeedRender();
+ virtual void clearSelection() = 0;
+
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void touchEvent(QTouchEvent *event);
virtual void mousePressEvent(QMouseEvent *event, const QPoint &mousePos);
@@ -223,9 +230,10 @@ public:
virtual void handleAxisSegmentCountChangedBySender(QObject *sender);
virtual void handleAxisSubSegmentCountChangedBySender(QObject *sender);
virtual void handleAxisAutoAdjustRangeChangedInOrientation(
- Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust) = 0;
+ QAbstract3DAxis::AxisOrientation orientation, bool autoAdjust) = 0;
virtual void handleAxisLabelFormatChangedBySender(QObject *sender);
virtual void handleSeriesVisibilityChangedBySender(QObject *sender);
+ virtual void handlePendingClick() = 0;
public slots:
void handleAxisTitleChanged(const QString &title);
@@ -235,7 +243,7 @@ public slots:
void handleAxisSubSegmentCountChanged(int count);
void handleAxisAutoAdjustRangeChanged(bool autoAdjust);
void handleAxisLabelFormatChanged(const QString &format);
- void handleInputStateChanged(QAbstract3DInputHandler::InputState state);
+ void handleInputViewChanged(QAbstract3DInputHandler::InputView view);
void handleInputPositionChanged(const QPoint &position);
void handleSeriesVisibilityChanged(bool visible);
@@ -246,29 +254,34 @@ public slots:
void handleThemeSingleHighlightGradientChanged(const QLinearGradient &gradient);
void handleThemeMultiHighlightColorChanged(const QColor &color);
void handleThemeMultiHighlightGradientChanged(const QLinearGradient &gradient);
+ void handleThemeTypeChanged(Q3DTheme::Theme theme);
// Renderer callback handlers
- void handleRequestShadowQuality(QDataVis::ShadowQuality quality);
+ void handleRequestShadowQuality(QAbstract3DGraph::ShadowQuality quality);
signals:
- void shadowQualityChanged(QDataVis::ShadowQuality quality);
+ void shadowQualityChanged(QAbstract3DGraph::ShadowQuality quality);
void activeInputHandlerChanged(QAbstract3DInputHandler *inputHandler);
- void themeChanged(Q3DTheme *theme);
- void selectionModeChanged(QDataVis::SelectionFlags mode);
+ void activeThemeChanged(Q3DTheme *activeTheme);
+ void selectionModeChanged(QAbstract3DGraph::SelectionFlags mode);
void needRender();
+ void axisXChanged(QAbstract3DAxis *axis);
+ void axisYChanged(QAbstract3DAxis *axis);
+ void axisZChanged(QAbstract3DAxis *axis);
protected:
- virtual Q3DAbstractAxis *createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation);
- Q3DValueAxis *createDefaultValueAxis();
- Q3DCategoryAxis *createDefaultCategoryAxis();
+ virtual QAbstract3DAxis *createDefaultAxis(QAbstract3DAxis::AxisOrientation orientation);
+ QValue3DAxis *createDefaultValueAxis();
+ QCategory3DAxis *createDefaultCategoryAxis();
+ virtual void startRecordingRemovesAndInserts();
private:
- void setAxisHelper(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis *axis,
- Q3DAbstractAxis **axisPtr);
+ void setAxisHelper(QAbstract3DAxis::AxisOrientation orientation, QAbstract3DAxis *axis,
+ QAbstract3DAxis **axisPtr);
friend class Bars3DController;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index 74088b7c..7824000e 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -17,7 +17,7 @@
****************************************************************************/
#include "abstract3drenderer_p.h"
-#include "q3dvalueaxis.h"
+#include "qvalue3daxis.h"
#include "texturehelper_p.h"
#include "utils_p.h"
#include "q3dscene_p.h"
@@ -27,27 +27,28 @@
#include "q3dtheme_p.h"
#include "objecthelper_p.h"
-Q_DECLARE_METATYPE(QtDataVisualization::QDataVis::ShadowQuality)
-
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller)
: QObject(0),
m_hasNegativeValues(false),
m_cachedTheme(new Q3DTheme()),
m_drawer(new Drawer(m_cachedTheme)),
- m_cachedShadowQuality(QDataVis::ShadowQualityMedium),
+ m_cachedShadowQuality(QAbstract3DGraph::ShadowQualityMedium),
m_autoScaleAdjustment(1.0f),
- m_cachedSelectionMode(QDataVis::SelectionNone),
+ m_cachedSelectionMode(QAbstract3DGraph::SelectionNone),
m_textureHelper(0),
m_cachedScene(new Q3DScene()),
m_selectionDirty(true),
m_selectionState(SelectNone),
- m_devicePixelRatio(1.0f)
- #ifdef DISPLAY_RENDER_SPEED
+ m_devicePixelRatio(1.0f),
+ m_selectionLabelDirty(true),
+ m_clickPending(false),
+ m_clickedSeries(0)
+#ifdef DISPLAY_RENDER_SPEED
, m_isFirstFrame(true),
m_numFrames(0)
- #endif
+#endif
{
QObject::connect(m_drawer, &Drawer::drawerChanged, this, &Abstract3DRenderer::updateTextures);
@@ -85,9 +86,9 @@ void Abstract3DRenderer::initializeOpenGL()
m_textureHelper = new TextureHelper();
m_drawer->initializeOpenGL();
- axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationX).setDrawer(m_drawer);
- axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationY).setDrawer(m_drawer);
- axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationZ).setDrawer(m_drawer);
+ axisCacheForOrientation(QAbstract3DAxis::AxisOrientationX).setDrawer(m_drawer);
+ axisCacheForOrientation(QAbstract3DAxis::AxisOrientationY).setDrawer(m_drawer);
+ axisCacheForOrientation(QAbstract3DAxis::AxisOrientationZ).setDrawer(m_drawer);
}
void Abstract3DRenderer::render(const GLuint defaultFboHandle)
@@ -102,7 +103,8 @@ void Abstract3DRenderer::render(const GLuint defaultFboHandle)
// Measure speed (as milliseconds per frame)
m_numFrames++;
if (m_lastFrameTime.elapsed() >= 1000) { // print only if last measurement was more than 1s ago
- qDebug() << float(m_lastFrameTime.elapsed()) / float(m_numFrames) << "ms/frame (=" << float(m_numFrames) << "fps)";
+ qDebug() << float(m_lastFrameTime.elapsed()) / float(m_numFrames) << "ms/frame (="
+ << float(m_numFrames) << "fps)";
m_numFrames = 0;
m_lastFrameTime.restart();
}
@@ -122,9 +124,15 @@ void Abstract3DRenderer::render(const GLuint defaultFboHandle)
m_viewport.y(),
m_viewport.width(),
m_viewport.height());
+ glScissor(m_viewport.x(),
+ m_viewport.y(),
+ m_viewport.width(),
+ m_viewport.height());
+ glEnable(GL_SCISSOR_TEST);
QVector3D clearColor = Utils::vectorFromColor(m_cachedTheme->windowColor());
glClearColor(clearColor.x(), clearColor.y(), clearColor.z(), 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glDisable(GL_SCISSOR_TEST);
}
QString Abstract3DRenderer::generateValueLabel(const QString &format, float value)
@@ -145,7 +153,8 @@ void Abstract3DRenderer::updateInputPosition(const QPoint &position)
m_inputPosition = position;
}
-void Abstract3DRenderer::initGradientShaders(const QString &vertexShader, const QString &fragmentShader)
+void Abstract3DRenderer::initGradientShaders(const QString &vertexShader,
+ const QString &fragmentShader)
{
// Do nothing by default
Q_UNUSED(vertexShader)
@@ -155,14 +164,10 @@ void Abstract3DRenderer::initGradientShaders(const QString &vertexShader, const
void Abstract3DRenderer::updateTheme(Q3DTheme *theme)
{
// Synchronize the controller theme with renderer
- bool changed = theme->d_ptr->sync(*m_cachedTheme->d_ptr);
+ bool updateDrawer = theme->d_ptr->sync(*m_cachedTheme->d_ptr);
- if (changed) {
- // Update drawer if sync changed something
+ if (updateDrawer)
m_drawer->setTheme(m_cachedTheme);
- // Re-initialize shaders
- reInitShaders();
- }
}
void Abstract3DRenderer::updateScene(Q3DScene *scene)
@@ -189,11 +194,15 @@ void Abstract3DRenderer::updateScene(Q3DScene *scene)
updateInputPosition(QPoint(logicalPixelPosition.x() * m_devicePixelRatio,
logicalPixelPosition.y() * m_devicePixelRatio));
+ // Synchronize the renderer scene to controller scene
+ scene->d_ptr->sync(*m_cachedScene->d_ptr);
+
if (Q3DScene::invalidSelectionPoint() == logicalPixelPosition) {
updateSelectionState(SelectNone);
} else {
// Selections are one-shot, reset selection active to false before processing
scene->setSelectionQueryPosition(Q3DScene::invalidSelectionPoint());
+ m_clickPending = true;
if (scene->isSlicingActive()) {
if (scene->isPointInPrimarySubView(logicalPixelPosition))
@@ -206,15 +215,12 @@ void Abstract3DRenderer::updateScene(Q3DScene *scene)
updateSelectionState(SelectOnScene);
}
}
-
- // Synchronize the controller scene with renderer
- scene->d_ptr->sync(*m_cachedScene->d_ptr);
}
void Abstract3DRenderer::reInitShaders()
{
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
initGradientShaders(QStringLiteral(":/shaders/vertexShadow"),
QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY"));
initShaders(QStringLiteral(":/shaders/vertexShadow"),
@@ -244,15 +250,15 @@ void Abstract3DRenderer::handleShadowQualityChange()
reInitShaders();
#if defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality != QDataVis::ShadowQualityNone) {
- emit requestShadowQuality(QDataVis::ShadowQualityNone);
+ if (m_cachedShadowQuality != QAbstract3DGraph::ShadowQualityNone) {
+ emit requestShadowQuality(QAbstract3DGraph::ShadowQualityNone);
qWarning("Shadows are not yet supported for OpenGL ES2");
- m_cachedShadowQuality = QDataVis::ShadowQualityNone;
+ m_cachedShadowQuality = QAbstract3DGraph::ShadowQualityNone;
}
#endif
}
-void Abstract3DRenderer::updateSelectionMode(QDataVis::SelectionFlags mode)
+void Abstract3DRenderer::updateSelectionMode(QAbstract3DGraph::SelectionFlags mode)
{
m_cachedSelectionMode = mode;
m_selectionDirty = true;
@@ -280,39 +286,46 @@ void Abstract3DRenderer::handleResize()
#endif
}
-void Abstract3DRenderer::updateAxisType(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis::AxisType type)
+void Abstract3DRenderer::updateAxisType(QAbstract3DAxis::AxisOrientation orientation,
+ QAbstract3DAxis::AxisType type)
{
axisCacheForOrientation(orientation).setType(type);
}
-void Abstract3DRenderer::updateAxisTitle(Q3DAbstractAxis::AxisOrientation orientation, const QString &title)
+void Abstract3DRenderer::updateAxisTitle(QAbstract3DAxis::AxisOrientation orientation,
+ const QString &title)
{
axisCacheForOrientation(orientation).setTitle(title);
}
-void Abstract3DRenderer::updateAxisLabels(Q3DAbstractAxis::AxisOrientation orientation, const QStringList &labels)
+void Abstract3DRenderer::updateAxisLabels(QAbstract3DAxis::AxisOrientation orientation,
+ const QStringList &labels)
{
axisCacheForOrientation(orientation).setLabels(labels);
}
-void Abstract3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max)
+void Abstract3DRenderer::updateAxisRange(QAbstract3DAxis::AxisOrientation orientation,
+ float min, float max)
{
AxisRenderCache &cache = axisCacheForOrientation(orientation);
cache.setMin(min);
cache.setMax(max);
}
-void Abstract3DRenderer::updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count)
+void Abstract3DRenderer::updateAxisSegmentCount(QAbstract3DAxis::AxisOrientation orientation,
+ int count)
{
axisCacheForOrientation(orientation).setSegmentCount(count);
}
-void Abstract3DRenderer::updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count)
+void Abstract3DRenderer::updateAxisSubSegmentCount(QAbstract3DAxis::AxisOrientation orientation,
+ int count)
{
axisCacheForOrientation(orientation).setSubSegmentCount(count);
}
-void Abstract3DRenderer::updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format)
+void Abstract3DRenderer::updateAxisLabelFormat(QAbstract3DAxis::AxisOrientation orientation,
+ const QString &format)
{
axisCacheForOrientation(orientation).setLabelFormat(format);
}
@@ -348,19 +361,26 @@ void Abstract3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesLi
visibleCount = 0;
}
foreach (QAbstract3DSeries *current, seriesList) {
- if (current->isVisible())
+ if (current->isVisible()) {
+ // Item selection label may need update
+ if (current->d_ptr->m_changeTracker.nameChanged
+ || current->d_ptr->m_changeTracker.itemLabelFormatChanged) {
+ m_selectionLabelDirty = true;
+ }
m_visibleSeriesList[visibleCount++].populate(current, this);
+ }
}
}
-AxisRenderCache &Abstract3DRenderer::axisCacheForOrientation(Q3DAbstractAxis::AxisOrientation orientation)
+AxisRenderCache &Abstract3DRenderer::axisCacheForOrientation(
+ QAbstract3DAxis::AxisOrientation orientation)
{
switch (orientation) {
- case Q3DAbstractAxis::AxisOrientationX:
+ case QAbstract3DAxis::AxisOrientationX:
return m_axisCacheX;
- case Q3DAbstractAxis::AxisOrientationY:
+ case QAbstract3DAxis::AxisOrientationY:
return m_axisCacheY;
- case Q3DAbstractAxis::AxisOrientationZ:
+ case QAbstract3DAxis::AxisOrientationZ:
return m_axisCacheZ;
default:
qFatal("Abstract3DRenderer::axisCacheForOrientation");
@@ -370,32 +390,32 @@ AxisRenderCache &Abstract3DRenderer::axisCacheForOrientation(Q3DAbstractAxis::Ax
void Abstract3DRenderer::lowerShadowQuality()
{
- QDataVis::ShadowQuality newQuality = QDataVis::ShadowQualityNone;
+ QAbstract3DGraph::ShadowQuality newQuality = QAbstract3DGraph::ShadowQualityNone;
switch (m_cachedShadowQuality) {
- case QDataVis::ShadowQualityHigh:
+ case QAbstract3DGraph::ShadowQualityHigh:
qWarning("Creating high quality shadows failed. Changing to medium quality.");
- newQuality = QDataVis::ShadowQualityMedium;
+ newQuality = QAbstract3DGraph::ShadowQualityMedium;
break;
- case QDataVis::ShadowQualityMedium:
+ case QAbstract3DGraph::ShadowQualityMedium:
qWarning("Creating medium quality shadows failed. Changing to low quality.");
- newQuality = QDataVis::ShadowQualityLow;
+ newQuality = QAbstract3DGraph::ShadowQualityLow;
break;
- case QDataVis::ShadowQualityLow:
+ case QAbstract3DGraph::ShadowQualityLow:
qWarning("Creating low quality shadows failed. Switching shadows off.");
- newQuality = QDataVis::ShadowQualityNone;
+ newQuality = QAbstract3DGraph::ShadowQualityNone;
break;
- case QDataVis::ShadowQualitySoftHigh:
+ case QAbstract3DGraph::ShadowQualitySoftHigh:
qWarning("Creating soft high quality shadows failed. Changing to soft medium quality.");
- newQuality = QDataVis::ShadowQualitySoftMedium;
+ newQuality = QAbstract3DGraph::ShadowQualitySoftMedium;
break;
- case QDataVis::ShadowQualitySoftMedium:
+ case QAbstract3DGraph::ShadowQualitySoftMedium:
qWarning("Creating soft medium quality shadows failed. Changing to soft low quality.");
- newQuality = QDataVis::ShadowQualitySoftLow;
+ newQuality = QAbstract3DGraph::ShadowQualitySoftLow;
break;
- case QDataVis::ShadowQualitySoftLow:
+ case QAbstract3DGraph::ShadowQualitySoftLow:
qWarning("Creating soft low quality shadows failed. Switching shadows off.");
- newQuality = QDataVis::ShadowQualityNone;
+ newQuality = QAbstract3DGraph::ShadowQualityNone;
break;
default:
// You'll never get here
@@ -406,7 +426,8 @@ void Abstract3DRenderer::lowerShadowQuality()
updateShadowQuality(newQuality);
}
-void Abstract3DRenderer::fixGradientAndGenerateTexture(QLinearGradient *gradient, GLuint *gradientTexture)
+void Abstract3DRenderer::fixGradientAndGenerateTexture(QLinearGradient *gradient,
+ GLuint *gradientTexture)
{
// Readjust start/stop to match gradient texture size
gradient->setStart(qreal(gradientTextureWidth), qreal(gradientTextureHeight));
@@ -420,4 +441,4 @@ void Abstract3DRenderer::fixGradientAndGenerateTexture(QLinearGradient *gradient
*gradientTexture = m_textureHelper->createGradientTexture(*gradient);
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h
index 17a55ac9..e7591a10 100644
--- a/src/datavisualization/engine/abstract3drenderer_p.h
+++ b/src/datavisualization/engine/abstract3drenderer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -29,9 +29,12 @@
#ifndef ABSTRACT3DRENDERER_P_H
#define ABSTRACT3DRENDERER_P_H
+//#define DISPLAY_RENDER_SPEED
+
#include <QtGui/QOpenGLFunctions>
-#include <QtGui/QFont>
+#ifdef DISPLAY_RENDER_SPEED
#include <QTime>
+#endif
#include "datavisualizationglobal_p.h"
#include "abstract3dcontroller_p.h"
@@ -39,9 +42,7 @@
#include "qabstractdataproxy.h"
#include "seriesrendercache_p.h"
-//#define DISPLAY_RENDER_SPEED
-
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class TextureHelper;
class Theme;
@@ -70,7 +71,7 @@ public:
virtual void render(GLuint defaultFboHandle);
virtual void updateTheme(Q3DTheme *theme);
- virtual void updateSelectionMode(QDataVis::SelectionFlags newMode);
+ virtual void updateSelectionMode(QAbstract3DGraph::SelectionFlags newMode);
virtual void updateScene(Q3DScene *scene);
virtual void updateTextures() = 0;
virtual void initSelectionBuffer() = 0;
@@ -80,24 +81,28 @@ public:
#if !defined(QT_OPENGL_ES_2)
virtual void updateDepthBuffer() = 0;
#endif
- virtual void updateShadowQuality(QDataVis::ShadowQuality quality) = 0;
+ virtual void updateShadowQuality(QAbstract3DGraph::ShadowQuality quality) = 0;
virtual void initShaders(const QString &vertexShader, const QString &fragmentShader) = 0;
virtual void initGradientShaders(const QString &vertexShader, const QString &fragmentShader);
virtual void initBackgroundShaders(const QString &vertexShader, const QString &fragmentShader) = 0;
- virtual void updateAxisType(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis::AxisType type);
- virtual void updateAxisTitle(Q3DAbstractAxis::AxisOrientation orientation, const QString &title);
- virtual void updateAxisLabels(Q3DAbstractAxis::AxisOrientation orientation, const QStringList &labels);
- virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max);
- virtual void updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
- virtual void updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
- virtual void updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format);
+ virtual void updateAxisType(QAbstract3DAxis::AxisOrientation orientation, QAbstract3DAxis::AxisType type);
+ virtual void updateAxisTitle(QAbstract3DAxis::AxisOrientation orientation, const QString &title);
+ virtual void updateAxisLabels(QAbstract3DAxis::AxisOrientation orientation, const QStringList &labels);
+ virtual void updateAxisRange(QAbstract3DAxis::AxisOrientation orientation, float min, float max);
+ virtual void updateAxisSegmentCount(QAbstract3DAxis::AxisOrientation orientation, int count);
+ virtual void updateAxisSubSegmentCount(QAbstract3DAxis::AxisOrientation orientation, int count);
+ virtual void updateAxisLabelFormat(QAbstract3DAxis::AxisOrientation orientation, const QString &format);
virtual void fixMeshFileName(QString &fileName, QAbstract3DSeries::Mesh mesh);
void fixGradientAndGenerateTexture(QLinearGradient *gradient, GLuint *gradientTexture);
+ inline bool isClickPending() { return m_clickPending; }
+ inline void clearClickPending() { m_clickPending = false; }
+ inline QAbstract3DSeries *clickedSeries() const { return m_clickedSeries; }
+
signals:
void needRender(); // Emit this if something in renderer causes need for another render pass.
- void requestShadowQuality(QDataVis::ShadowQuality quality); // For automatic quality adjustments
+ void requestShadowQuality(QAbstract3DGraph::ShadowQuality quality); // For automatic quality adjustments
protected:
Abstract3DRenderer(Abstract3DController *controller);
@@ -108,7 +113,7 @@ protected:
virtual void handleShadowQualityChange();
virtual void handleResize();
- AxisRenderCache &axisCacheForOrientation(Q3DAbstractAxis::AxisOrientation orientation);
+ AxisRenderCache &axisCacheForOrientation(QAbstract3DAxis::AxisOrientation orientation);
virtual void lowerShadowQuality();
@@ -118,10 +123,10 @@ protected:
Q3DTheme *m_cachedTheme;
Drawer *m_drawer;
QRect m_viewport;
- QDataVis::ShadowQuality m_cachedShadowQuality;
+ QAbstract3DGraph::ShadowQuality m_cachedShadowQuality;
GLfloat m_autoScaleAdjustment;
- QDataVis::SelectionFlags m_cachedSelectionMode;
+ QAbstract3DGraph::SelectionFlags m_cachedSelectionMode;
AxisRenderCache m_axisCacheX;
AxisRenderCache m_axisCacheY;
@@ -137,6 +142,9 @@ protected:
QRect m_primarySubViewport;
QRect m_secondarySubViewport;
float m_devicePixelRatio;
+ bool m_selectionLabelDirty;
+ bool m_clickPending;
+ QAbstract3DSeries *m_clickedSeries;
#ifdef DISPLAY_RENDER_SPEED
bool m_isFirstFrame;
@@ -145,6 +153,6 @@ protected:
#endif
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
-#endif // ABSTRACT3DRENDERER_P_H
+#endif
diff --git a/src/datavisualization/engine/axisrendercache.cpp b/src/datavisualization/engine/axisrendercache.cpp
index f7960b2b..c1c2d5bd 100644
--- a/src/datavisualization/engine/axisrendercache.cpp
+++ b/src/datavisualization/engine/axisrendercache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -20,10 +20,10 @@
#include "qmath.h"
#include <QFontMetrics>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
AxisRenderCache::AxisRenderCache()
- : m_type(Q3DAbstractAxis::AxisTypeNone),
+ : m_type(QAbstract3DAxis::AxisTypeNone),
m_min(0.0f),
m_max(10.0f),
m_segmentCount(5),
@@ -51,7 +51,7 @@ void AxisRenderCache::setDrawer(Drawer *drawer)
}
}
-void AxisRenderCache::setType(Q3DAbstractAxis::AxisType type)
+void AxisRenderCache::setType(QAbstract3DAxis::AxisType type)
{
m_type = type;
@@ -183,4 +183,4 @@ int AxisRenderCache::maxLabelWidth(const QStringList &labels) const
return labelWidth;
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/axisrendercache_p.h b/src/datavisualization/engine/axisrendercache_p.h
index cddc7839..e1c51e7c 100644
--- a/src/datavisualization/engine/axisrendercache_p.h
+++ b/src/datavisualization/engine/axisrendercache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -31,10 +31,10 @@
#include "datavisualizationglobal_p.h"
#include "labelitem_p.h"
-#include "q3dabstractaxis_p.h"
+#include "qabstract3daxis_p.h"
#include "drawer_p.h"
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class AxisRenderCache : public QObject
{
@@ -45,8 +45,8 @@ public:
void setDrawer(Drawer *drawer);
- void setType(Q3DAbstractAxis::AxisType type);
- inline Q3DAbstractAxis::AxisType type() const { return m_type; }
+ void setType(QAbstract3DAxis::AxisType type);
+ inline QAbstract3DAxis::AxisType type() const { return m_type; }
void setTitle(const QString &title);
inline const QString &title() { return m_title; }
void setLabels(const QStringList &labels);
@@ -76,7 +76,7 @@ private:
int maxLabelWidth(const QStringList &labels) const;
// Cached axis values
- Q3DAbstractAxis::AxisType m_type;
+ QAbstract3DAxis::AxisType m_type;
QString m_title;
QStringList m_labels;
float m_min;
@@ -96,6 +96,6 @@ private:
Q_DISABLE_COPY(AxisRenderCache)
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp
index 5232a566..5bd37ccf 100644
--- a/src/datavisualization/engine/bars3dcontroller.cpp
+++ b/src/datavisualization/engine/bars3dcontroller.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,9 +19,9 @@
#include "bars3dcontroller_p.h"
#include "bars3drenderer_p.h"
#include "camerahelper_p.h"
-#include "q3dabstractaxis_p.h"
-#include "q3dvalueaxis_p.h"
-#include "q3dcategoryaxis_p.h"
+#include "qabstract3daxis_p.h"
+#include "qvalue3daxis_p.h"
+#include "qcategory3daxis_p.h"
#include "qbardataproxy_p.h"
#include "qbar3dseries_p.h"
#include "thememanager_p.h"
@@ -30,12 +30,14 @@
#include <QMatrix4x4>
#include <qmath.h>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
-Bars3DController::Bars3DController(QRect boundRect)
- : Abstract3DController(boundRect),
+Bars3DController::Bars3DController(QRect boundRect, Q3DScene *scene)
+ : Abstract3DController(boundRect, scene),
m_selectedBar(invalidSelectionPosition()),
m_selectedBarSeries(0),
+ m_primarySeries(0),
+ m_isMultiSeriesUniform(false),
m_isBarSpecRelative(true),
m_barThicknessRatio(1.0f),
m_barSpacing(QSizeF(1.0, 1.0)),
@@ -64,15 +66,16 @@ void Bars3DController::initializeOpenGL()
setRenderer(m_renderer);
synchDataToRenderer();
- QObject::connect(m_renderer, &Bars3DRenderer::barClicked, this,
- &Bars3DController::handleBarClicked, Qt::QueuedConnection);
emitNeedRender();
}
void Bars3DController::synchDataToRenderer()
{
+ if (!isInitialized())
+ return;
+
// Background change requires reloading the meshes in bar graphs, so dirty the series visuals
- if (m_themeManager->theme()->d_ptr->m_dirtyBits.backgroundEnabledDirty) {
+ if (m_themeManager->activeTheme()->d_ptr->m_dirtyBits.backgroundEnabledDirty) {
m_isSeriesVisualsDirty = true;
foreach (QAbstract3DSeries *series, m_seriesList)
series->d_ptr->m_changeTracker.meshChanged = true;
@@ -80,10 +83,12 @@ void Bars3DController::synchDataToRenderer()
Abstract3DController::synchDataToRenderer();
- if (!isInitialized())
- return;
-
// Notify changes to renderer
+ if (m_changeTracker.multiSeriesScalingChanged) {
+ m_renderer->updateMultiSeriesScaling(m_isMultiSeriesUniform);
+ m_changeTracker.multiSeriesScalingChanged = false;
+ }
+
if (m_changeTracker.barSpecsChanged) {
m_renderer->updateBarSpecs(m_barThicknessRatio, m_barSpacing, m_isBarSpecRelative);
m_changeTracker.barSpecsChanged = false;
@@ -98,8 +103,11 @@ void Bars3DController::synchDataToRenderer()
void Bars3DController::handleArrayReset()
{
- adjustAxisRanges();
- m_isDataDirty = true;
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
// Clear selection unless still valid
setSelectedBar(m_selectedBar, m_selectedBarSeries);
emitNeedRender();
@@ -109,8 +117,11 @@ void Bars3DController::handleRowsAdded(int startIndex, int count)
{
Q_UNUSED(startIndex)
Q_UNUSED(count)
- adjustAxisRanges();
- m_isDataDirty = true;
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
emitNeedRender();
}
@@ -118,8 +129,11 @@ void Bars3DController::handleRowsChanged(int startIndex, int count)
{
Q_UNUSED(startIndex)
Q_UNUSED(count)
- adjustAxisRanges();
- m_isDataDirty = true;
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
emitNeedRender();
}
@@ -127,11 +141,25 @@ void Bars3DController::handleRowsRemoved(int startIndex, int count)
{
Q_UNUSED(startIndex)
Q_UNUSED(count)
- adjustAxisRanges();
- m_isDataDirty = true;
- // Clear selection unless still valid
- setSelectedBar(m_selectedBar, m_selectedBarSeries);
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series == m_selectedBarSeries) {
+ // If rows removed from selected series before the selection, adjust the selection
+ int selectedRow = m_selectedBar.x();
+ if (startIndex <= selectedRow) {
+ if ((startIndex + count) > selectedRow)
+ selectedRow = -1; // Selected row removed
+ else
+ selectedRow -= count; // Move selected row down by amount of rows removed
+
+ setSelectedBar(QPoint(selectedRow, m_selectedBar.y()), m_selectedBarSeries);
+ }
+ }
+
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
emitNeedRender();
}
@@ -140,8 +168,21 @@ void Bars3DController::handleRowsInserted(int startIndex, int count)
{
Q_UNUSED(startIndex)
Q_UNUSED(count)
- adjustAxisRanges();
- m_isDataDirty = true;
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series == m_selectedBarSeries) {
+ // If rows inserted to selected series before the selection, adjust the selection
+ int selectedRow = m_selectedBar.x();
+ if (startIndex <= selectedRow) {
+ selectedRow += count;
+ setSelectedBar(QPoint(selectedRow, m_selectedBar.y()), m_selectedBarSeries);
+ }
+ }
+
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
+
emitNeedRender();
}
@@ -149,50 +190,44 @@ void Bars3DController::handleItemChanged(int rowIndex, int columnIndex)
{
Q_UNUSED(rowIndex)
Q_UNUSED(columnIndex)
- adjustAxisRanges();
- m_isDataDirty = true;
+ QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
+ if (series->isVisible()) {
+ adjustAxisRanges();
+ m_isDataDirty = true;
+ }
emitNeedRender();
}
void Bars3DController::handleDataRowLabelsChanged()
{
- QBar3DSeries *firstSeries = 0;
- if (m_seriesList.size())
- firstSeries = static_cast<QBar3DSeries *>(m_seriesList.at(0));
- if (m_axisZ && firstSeries && firstSeries->dataProxy()) {
+ if (m_axisZ) {
// Grab a sublist equal to data window (no need to have more labels in axis)
int min = int(m_axisZ->min());
int count = int(m_axisZ->max()) - min + 1;
- QStringList subList = firstSeries->dataProxy()->rowLabels().mid(min, count);
- static_cast<Q3DCategoryAxis *>(m_axisZ)->dptr()->setDataLabels(subList);
+ QStringList subList;
+ if (m_primarySeries && m_primarySeries->dataProxy())
+ subList = m_primarySeries->dataProxy()->rowLabels().mid(min, count);
+ static_cast<QCategory3DAxis *>(m_axisZ)->dptr()->setDataLabels(subList);
}
}
void Bars3DController::handleDataColumnLabelsChanged()
{
- QBar3DSeries *firstSeries = 0;
- if (m_seriesList.size())
- firstSeries = static_cast<QBar3DSeries *>(m_seriesList.at(0));
- if (m_axisX && firstSeries && firstSeries->dataProxy()) {
+ if (m_axisX) {
// Grab a sublist equal to data window (no need to have more labels in axis)
int min = int(m_axisX->min());
int count = int(m_axisX->max()) - min + 1;
- QStringList subList = static_cast<QBarDataProxy *>(firstSeries->dataProxy())
- ->columnLabels().mid(min, count);
- static_cast<Q3DCategoryAxis *>(m_axisX)->dptr()->setDataLabels(subList);
+ QStringList subList;
+ if (m_primarySeries && m_primarySeries->dataProxy()) {
+ subList = static_cast<QBarDataProxy *>(m_primarySeries->dataProxy())
+ ->columnLabels().mid(min, count);
+ }
+ static_cast<QCategory3DAxis *>(m_axisX)->dptr()->setDataLabels(subList);
}
}
-void Bars3DController::handleBarClicked(const QPoint &position, QBar3DSeries *series)
-{
- setSelectedBar(position, series);
-
- // TODO: pass clicked to parent. (QTRD-2517)
- // TODO: Also hover needed? (QTRD-2131)
-}
-
void Bars3DController::handleAxisAutoAdjustRangeChangedInOrientation(
- Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust)
+ QAbstract3DAxis::AxisOrientation orientation, bool autoAdjust)
{
Q_UNUSED(orientation)
Q_UNUSED(autoAdjust)
@@ -203,63 +238,120 @@ void Bars3DController::handleSeriesVisibilityChangedBySender(QObject *sender)
{
Abstract3DController::handleSeriesVisibilityChangedBySender(sender);
+ adjustAxisRanges();
+
// Visibility changes may require disabling/enabling slicing,
// so just reset selection to ensure everything is still valid.
setSelectedBar(m_selectedBar, m_selectedBarSeries);
}
+void Bars3DController::handlePendingClick()
+{
+ // This function is called while doing the sync, so it is okay to query from renderer
+ QPoint position = m_renderer->clickedPosition();
+ QBar3DSeries *series = static_cast<QBar3DSeries *>(m_renderer->clickedSeries());
+
+ setSelectedBar(position, series);
+
+ m_renderer->resetClickedStatus();
+}
+
QPoint Bars3DController::invalidSelectionPosition()
{
static QPoint invalidSelectionPos(-1, -1);
return invalidSelectionPos;
}
-void Bars3DController::setAxisX(Q3DAbstractAxis *axis)
+void Bars3DController::setAxisX(QAbstract3DAxis *axis)
{
Abstract3DController::setAxisX(axis);
handleDataColumnLabelsChanged();
}
-void Bars3DController::setAxisZ(Q3DAbstractAxis *axis)
+void Bars3DController::setAxisZ(QAbstract3DAxis *axis)
{
Abstract3DController::setAxisZ(axis);
handleDataRowLabelsChanged();
}
-void Bars3DController::addSeries(QAbstract3DSeries *series)
+void Bars3DController::setPrimarySeries(QBar3DSeries *series)
{
- Q_ASSERT(series && series->type() == QAbstract3DSeries::SeriesTypeBar);
-
- bool firstAdded = !m_seriesList.size();
-
- Abstract3DController::addSeries(series);
-
- if (firstAdded) {
- adjustAxisRanges();
+ if (!series) {
+ if (m_seriesList.size())
+ series = static_cast<QBar3DSeries *>(m_seriesList.at(0));
+ } else if (!m_seriesList.contains(series)) {
+ // Add nonexistent series.
+ addSeries(series);
+ }
+ if (m_primarySeries != series) {
+ m_primarySeries = series;
handleDataRowLabelsChanged();
handleDataColumnLabelsChanged();
+ emit primarySeriesChanged(m_primarySeries);
}
+}
+
+QBar3DSeries *Bars3DController::primarySeries() const
+{
+ return m_primarySeries;
+}
- QBar3DSeries *barSeries = static_cast<QBar3DSeries *>(series);
- if (barSeries->selectedBar() != invalidSelectionPosition())
- setSelectedBar(barSeries->selectedBar(), barSeries);
+void Bars3DController::addSeries(QAbstract3DSeries *series)
+{
+ insertSeries(m_seriesList.size(), series);
}
void Bars3DController::removeSeries(QAbstract3DSeries *series)
{
- bool firstRemoved = (m_seriesList.size() && m_seriesList.at(0) == series);
+ bool wasVisible = (series && series->d_ptr->m_controller == this && series->isVisible());
Abstract3DController::removeSeries(series);
if (m_selectedBarSeries == series)
setSelectedBar(invalidSelectionPosition(), 0);
- if (firstRemoved) {
+ if (wasVisible)
adjustAxisRanges();
+ // If primary series is removed, reset it to default
+ if (series == m_primarySeries) {
+ if (m_seriesList.size())
+ m_primarySeries = static_cast<QBar3DSeries *>(m_seriesList.at(0));
+ else
+ m_primarySeries = 0;
+
handleDataRowLabelsChanged();
handleDataColumnLabelsChanged();
+
+ emit primarySeriesChanged(m_primarySeries);
+ }
+}
+
+void Bars3DController::insertSeries(int index, QAbstract3DSeries *series)
+{
+ Q_ASSERT(series && series->type() == QAbstract3DSeries::SeriesTypeBar);
+
+ int oldSize = m_seriesList.size();
+
+ Abstract3DController::insertSeries(index, series);
+
+ if (oldSize != m_seriesList.size()) {
+ if (series->isVisible())
+ adjustAxisRanges();
+
+ QBar3DSeries *barSeries = static_cast<QBar3DSeries *>(series);
+ if (!oldSize) {
+ m_primarySeries = barSeries;
+ handleDataRowLabelsChanged();
+ handleDataColumnLabelsChanged();
+ }
+
+ if (barSeries->selectedBar() != invalidSelectionPosition())
+ setSelectedBar(barSeries->selectedBar(), barSeries);
+
+ if (!oldSize)
+ emit primarySeriesChanged(m_primarySeries);
}
}
@@ -292,6 +384,19 @@ void Bars3DController::handleAxisRangeChangedBySender(QObject *sender)
setSelectedBar(m_selectedBar, m_selectedBarSeries);
}
+void Bars3DController::setMultiSeriesScaling(bool uniform)
+{
+ m_isMultiSeriesUniform = uniform;
+
+ m_changeTracker.multiSeriesScalingChanged = true;
+ emitNeedRender();
+}
+
+bool Bars3DController::multiSeriesScaling() const
+{
+ return m_isMultiSeriesUniform;
+}
+
void Bars3DController::setBarSpecs(GLfloat thicknessRatio, const QSizeF &spacing, bool relative)
{
m_barThicknessRatio = thicknessRatio;
@@ -317,13 +422,14 @@ bool Bars3DController::isBarSpecRelative()
return m_isBarSpecRelative;
}
-void Bars3DController::setSelectionMode(QDataVis::SelectionFlags mode)
+void Bars3DController::setSelectionMode(QAbstract3DGraph::SelectionFlags mode)
{
- if (mode.testFlag(QDataVis::SelectionSlice)
- && (mode.testFlag(QDataVis::SelectionRow) == mode.testFlag(QDataVis::SelectionColumn))) {
+ if (mode.testFlag(QAbstract3DGraph::SelectionSlice)
+ && (mode.testFlag(QAbstract3DGraph::SelectionRow)
+ == mode.testFlag(QAbstract3DGraph::SelectionColumn))) {
qWarning("Must specify one of either row or column selection mode in conjunction with slicing mode.");
} else {
- QDataVis::SelectionFlags oldMode = selectionMode();
+ QAbstract3DGraph::SelectionFlags oldMode = selectionMode();
Abstract3DController::setSelectionMode(mode);
@@ -334,8 +440,8 @@ void Bars3DController::setSelectionMode(QDataVis::SelectionFlags mode)
// Special case: Always deactivate slicing when changing away from slice
// automanagement, as this can't be handled in setSelectedBar.
- if (!mode.testFlag(QDataVis::SelectionSlice)
- && oldMode.testFlag(QDataVis::SelectionSlice)) {
+ if (!mode.testFlag(QAbstract3DGraph::SelectionSlice)
+ && oldMode.testFlag(QAbstract3DGraph::SelectionSlice)) {
scene()->setSlicingActive(false);
}
}
@@ -353,7 +459,7 @@ void Bars3DController::setSelectedBar(const QPoint &position, QBar3DSeries *seri
adjustSelectionPosition(pos, series);
- if (selectionMode().testFlag(QDataVis::SelectionSlice)) {
+ if (selectionMode().testFlag(QAbstract3DGraph::SelectionSlice)) {
// If the selected bar is outside data window, or there is no visible selected bar, disable slicing
if (pos.x() < m_axisZ->min() || pos.x() > m_axisZ->max()
|| pos.y() < m_axisX->min() || pos.y() > m_axisX->max()
@@ -383,11 +489,16 @@ void Bars3DController::setSelectedBar(const QPoint &position, QBar3DSeries *seri
}
}
+void Bars3DController::clearSelection()
+{
+ setSelectedBar(invalidSelectionPosition(), 0);
+}
+
void Bars3DController::adjustAxisRanges()
{
- Q3DCategoryAxis *categoryAxisZ = static_cast<Q3DCategoryAxis *>(m_axisZ);
- Q3DCategoryAxis *categoryAxisX = static_cast<Q3DCategoryAxis *>(m_axisX);
- Q3DValueAxis *valueAxis = static_cast<Q3DValueAxis *>(m_axisY);
+ QCategory3DAxis *categoryAxisZ = static_cast<QCategory3DAxis *>(m_axisZ);
+ QCategory3DAxis *categoryAxisX = static_cast<QCategory3DAxis *>(m_axisX);
+ QValue3DAxis *valueAxis = static_cast<QValue3DAxis *>(m_axisY);
bool adjustZ = (categoryAxisZ && categoryAxisZ->isAutoAdjustRange());
bool adjustX = (categoryAxisX && categoryAxisX->isAutoAdjustRange());
@@ -493,11 +604,11 @@ void Bars3DController::adjustSelectionPosition(QPoint &pos, const QBar3DSeries *
}
}
-Q3DAbstractAxis *Bars3DController::createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation)
+QAbstract3DAxis *Bars3DController::createDefaultAxis(QAbstract3DAxis::AxisOrientation orientation)
{
- Q3DAbstractAxis *defaultAxis = 0;
+ QAbstract3DAxis *defaultAxis = 0;
- if (orientation == Q3DAbstractAxis::AxisOrientationY)
+ if (orientation == QAbstract3DAxis::AxisOrientationY)
defaultAxis = createDefaultValueAxis();
else
defaultAxis = createDefaultCategoryAxis();
@@ -505,4 +616,4 @@ Q3DAbstractAxis *Bars3DController::createDefaultAxis(Q3DAbstractAxis::AxisOrient
return defaultAxis;
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/bars3dcontroller_p.h b/src/datavisualization/engine/bars3dcontroller_p.h
index 54385571..e704aea1 100644
--- a/src/datavisualization/engine/bars3dcontroller_p.h
+++ b/src/datavisualization/engine/bars3dcontroller_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -32,20 +32,20 @@
#include "datavisualizationglobal_p.h"
#include "abstract3dcontroller_p.h"
-//#define DISPLAY_RENDER_SPEED
-
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class Bars3DRenderer;
class QBar3DSeries;
struct Bars3DChangeBitField {
- bool slicingActiveChanged : 1;
- bool barSpecsChanged : 1;
- bool selectedBarChanged : 1;
+ bool slicingActiveChanged : 1;
+ bool multiSeriesScalingChanged : 1;
+ bool barSpecsChanged : 1;
+ bool selectedBarChanged : 1;
Bars3DChangeBitField() :
slicingActiveChanged(true),
+ multiSeriesScalingChanged(true),
barSpecsChanged(true),
selectedBarChanged(true)
{
@@ -63,8 +63,10 @@ private:
QPoint m_selectedBar; // Points to row & column in data window.
QBar3DSeries *m_selectedBarSeries; // Points to the series for which the bar is selected in
// single series selection cases.
+ QBar3DSeries *m_primarySeries; // Category axis labels are taken from the primary series
// Look'n'feel
+ bool m_isMultiSeriesUniform;
bool m_isBarSpecRelative;
GLfloat m_barThicknessRatio;
QSizeF m_barSpacing;
@@ -73,12 +75,15 @@ private:
Bars3DRenderer *m_renderer;
public:
- explicit Bars3DController(QRect rect);
+ explicit Bars3DController(QRect rect, Q3DScene *scene = 0);
~Bars3DController();
virtual void initializeOpenGL();
virtual void synchDataToRenderer();
+ void setMultiSeriesScaling(bool uniform);
+ bool multiSeriesScaling() const;
+
// bar thickness, spacing between bars, and is spacing relative to thickness or absolute
// y -component sets the thickness/spacing of z -direction
// With relative 0.0f means side-to-side, 1.0f = one thickness in between
@@ -89,19 +94,24 @@ public:
QSizeF barSpacing();
bool isBarSpecRelative();
- void setSelectionMode(QDataVis::SelectionFlags mode);
+ void setSelectionMode(QAbstract3DGraph::SelectionFlags mode);
void setSelectedBar(const QPoint &position, QBar3DSeries *series);
+ virtual void clearSelection();
- virtual void handleAxisAutoAdjustRangeChangedInOrientation(Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust);
+ virtual void handleAxisAutoAdjustRangeChangedInOrientation(QAbstract3DAxis::AxisOrientation orientation, bool autoAdjust);
virtual void handleSeriesVisibilityChangedBySender(QObject *sender);
+ virtual void handlePendingClick();
static QPoint invalidSelectionPosition();
- virtual void setAxisX(Q3DAbstractAxis *axis);
- virtual void setAxisZ(Q3DAbstractAxis *axis);
+ virtual void setAxisX(QAbstract3DAxis *axis);
+ virtual void setAxisZ(QAbstract3DAxis *axis);
+ virtual void setPrimarySeries(QBar3DSeries *series);
+ virtual QBar3DSeries *primarySeries() const;
virtual void addSeries(QAbstract3DSeries *series);
virtual void removeSeries(QAbstract3DSeries *series);
+ virtual void insertSeries(int index, QAbstract3DSeries *series);
virtual QList<QBar3DSeries *> barSeriesList();
virtual void handleAxisRangeChangedBySender(QObject *sender);
@@ -116,11 +126,11 @@ public slots:
void handleDataRowLabelsChanged();
void handleDataColumnLabelsChanged();
- // Renderer callback handlers
- void handleBarClicked(const QPoint &position, QBar3DSeries *series);
+signals:
+ void primarySeriesChanged(QBar3DSeries *series);
protected:
- virtual Q3DAbstractAxis *createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation);
+ virtual QAbstract3DAxis *createDefaultAxis(QAbstract3DAxis::AxisOrientation orientation);
private:
void adjustAxisRanges();
@@ -130,7 +140,6 @@ private:
};
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index f13b6e79..664dbabd 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -38,12 +38,13 @@
// You should see the scene from where the light is
//#define SHOW_DEPTH_TEXTURE_SCENE
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
const GLfloat labelMargin = 0.05f;
const GLfloat gridLineWidth = 0.005f;
-const bool sliceGridLabels = true; // TODO: Make this user controllable (QTRD-2546)
+const bool sliceGridLabels = true;
+const QQuaternion identityQuaternion;
Bars3DRenderer::Bars3DRenderer(Bars3DController *controller)
: Abstract3DRenderer(controller),
@@ -89,9 +90,12 @@ Bars3DRenderer::Bars3DRenderer(Bars3DController *controller)
m_selectedBarPos(Bars3DController::invalidSelectionPosition()),
m_selectedBarSeries(0),
m_noZeroInRange(false),
- m_seriesScale(0.0f),
+ m_seriesScaleX(0.0f),
+ m_seriesScaleZ(0.0f),
m_seriesStep(0.0f),
- m_seriesStart(0.0f)
+ m_seriesStart(0.0f),
+ m_clickedPosition(Bars3DController::invalidSelectionPosition()),
+ m_keepSeriesUniform(false)
{
initializeOpenGLFunctions();
initializeOpenGL();
@@ -159,11 +163,17 @@ void Bars3DRenderer::updateData()
if (m_renderingArrays.size() != seriesCount) {
m_renderingArrays.resize(seriesCount);
- m_seriesScale = 1.0f / float(seriesCount);
+ m_seriesScaleX = 1.0f / float(seriesCount);
m_seriesStep = 1.0f / float(seriesCount);
m_seriesStart = -((float(seriesCount) - 1.0f) / 2.0f) * m_seriesStep;
}
+
+ if (m_keepSeriesUniform)
+ m_seriesScaleZ = m_seriesScaleX;
+ else
+ m_seriesScaleZ = 1.0f;
+
if (m_cachedRowCount != newRows || m_cachedColumnCount != newColumns) {
// Force update for selection related items
m_sliceCache = 0;
@@ -181,12 +191,13 @@ void Bars3DRenderer::updateData()
}
for (int series = 0; series < seriesCount; series++) {
- if (newRows != m_renderingArrays.at(series).size()
- || newColumns != m_renderingArrays.at(series).at(0).size()) {
+ BarRenderItemArray &renderArray = m_renderingArrays[series];
+ if (newRows != renderArray.size()
+ || newColumns != renderArray.at(0).size()) {
// Destroy old render items and reallocate new array
- m_renderingArrays[series].resize(newRows);
+ renderArray.resize(newRows);
for (int i = 0; i < newRows; i++)
- m_renderingArrays[series][i].resize(newColumns);
+ renderArray[i].resize(newColumns);
}
// Update cached data window
@@ -199,10 +210,10 @@ void Bars3DRenderer::updateData()
GLfloat heightValue = 0.0f;
for (int i = 0; i < newRows; i++) {
int j = 0;
+ BarRenderItemRow &renderRow = renderArray[i];
if (dataRowIndex < dataRowCount) {
const QBarDataRow *dataRow = dataProxy->rowAt(dataRowIndex);
- updateSize = qMin((dataRow->size() - minCol),
- m_renderingArrays.at(series).at(i).size());
+ updateSize = qMin((dataRow->size() - minCol), renderRow.size());
if (dataRow) {
int dataColIndex = minCol;
for (; j < updateSize ; j++) {
@@ -221,15 +232,24 @@ void Bars3DRenderer::updateData()
heightValue = 0.0f;
}
}
- m_renderingArrays[series][i][j].setValue(value);
- m_renderingArrays[series][i][j].setHeight(heightValue / m_heightNormalizer);
+ renderRow[j].setValue(value);
+ renderRow[j].setHeight(heightValue / m_heightNormalizer);
+ float angle = dataRow->at(dataColIndex).rotation();
+ if (angle) {
+ renderRow[j].setRotation(
+ QQuaternion::fromAxisAndAngle(
+ upVector, angle));
+ } else {
+ renderRow[j].setRotation(identityQuaternion);
+ }
dataColIndex++;
}
}
}
for (; j < m_renderingArrays.at(series).at(i).size(); j++) {
- m_renderingArrays[series][i][j].setValue(0.0f);
- m_renderingArrays[series][i][j].setHeight(0.0f);
+ renderRow[j].setValue(0.0f);
+ renderRow[j].setHeight(0.0f);
+ renderRow[j].setRotation(identityQuaternion);
}
dataRowIndex++;
}
@@ -239,9 +259,20 @@ void Bars3DRenderer::updateData()
updateSelectedBar(m_selectedBarPos, m_selectedBarSeries);
}
+void Bars3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesList, bool updateVisibility)
+{
+ Abstract3DRenderer::updateSeries(seriesList, updateVisibility);
+
+ // Fix the series rotations - ignore any rotations that are not along Y-axis
+ for (int series = 0; series < m_visibleSeriesList.size(); series++) {
+ QVector3D vector = m_visibleSeriesList.at(series).meshRotation().vector();
+ if (vector.x() || vector.z())
+ m_visibleSeriesList[series].setMeshRotation(identityQuaternion);
+ }
+}
+
void Bars3DRenderer::updateScene(Q3DScene *scene)
{
- // TODO: See QTRD-2374
if (m_hasNegativeValues)
scene->activeCamera()->setMinYRotation(-90.0);
else
@@ -274,6 +305,8 @@ void Bars3DRenderer::drawSlicedScene()
{
GLfloat barPosX = 0;
QVector3D lightPos;
+ QVector3D lightColor = Utils::vectorFromColor(m_cachedTheme->lightColor());
+ static QQuaternion ninetyDegreeRotation = QQuaternion::fromAxisAndAngle(upVector, 90.0f);
// Specify viewport
glViewport(m_secondarySubViewport.x(),
@@ -283,7 +316,7 @@ void Bars3DRenderer::drawSlicedScene()
// Set up projection matrix
QMatrix4x4 projectionMatrix;
- projectionMatrix.perspective(40.0f, (GLfloat)m_secondarySubViewport.width()
+ projectionMatrix.perspective(35.0f, (GLfloat)m_secondarySubViewport.width()
/ (GLfloat)m_secondarySubViewport.height(), 0.1f, 100.0f);
// Set view matrix
@@ -300,16 +333,18 @@ void Bars3DRenderer::drawSlicedScene()
const Q3DCamera *activeCamera = m_cachedScene->activeCamera();
// Draw the selected row / column
- GLfloat barPosYAdjustment = -0.8f; // Positives only -> translate to -1.0 + 0.2 for row/column labels
- if (m_hasNegativeValues) {
- if (m_noZeroInRange)
- barPosYAdjustment = 1.2f; // Negatives only -> translate to 1.0 + 0.2 for row/column labels
- else
- barPosYAdjustment = 0.2f; // Both -> translate to 0.0 + 0.2 for row/column labels
- }
QMatrix4x4 projectionViewMatrix = projectionMatrix * viewMatrix;
- bool rowMode = m_cachedSelectionMode.testFlag(QDataVis::SelectionRow);
- bool itemMode = m_cachedSelectionMode.testFlag(QDataVis::SelectionItem);
+ bool rowMode = m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow);
+ bool itemMode = m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionItem);
+
+ GLfloat barPosYAdjustment = -0.8f; // Translate to -1.0 + 0.2 for row/column labels
+ GLfloat scaleFactor = 0.0f;
+ GLfloat barLabelYPos = barPosYAdjustment - 0.4f - labelMargin; // 0.4 for labels
+ GLfloat zeroPosAdjustment = 0.0f;
+ if (!m_noZeroInRange)
+ zeroPosAdjustment = 2.0f * m_axisCacheY.min() / m_heightNormalizer;
+ else if (m_hasNegativeValues)
+ zeroPosAdjustment = -2.0f;
// Draw grid lines
if (m_cachedTheme->isGridEnabled()) {
@@ -323,24 +358,20 @@ void Bars3DRenderer::drawSlicedScene()
lineShader->setUniformValue(lineShader->lightP(), lightPos);
lineShader->setUniformValue(lineShader->view(), viewMatrix);
lineShader->setUniformValue(lineShader->color(), lineColor);
- lineShader->setUniformValue(lineShader->ambientS(), m_cachedTheme->ambientLightStrength() * 2.0f);
- lineShader->setUniformValue(lineShader->lightS(), 0.25f);
+ lineShader->setUniformValue(lineShader->ambientS(),
+ m_cachedTheme->ambientLightStrength() * 2.3f);
+ lineShader->setUniformValue(lineShader->lightS(), 0.0f);
+ lineShader->setUniformValue(lineShader->lightColor(), lightColor);
- GLfloat scaleFactor = 0.0f;
if (rowMode)
scaleFactor = (1.1f * m_rowWidth) / m_scaleFactor;
else
scaleFactor = (1.1f * m_columnDepth) / m_scaleFactor;
- GLfloat startLine = 0.0f;
- if (m_noZeroInRange)
- startLine = 2.0f * (m_axisCacheY.min() - m_axisCacheY.max()) / m_heightNormalizer;
- else
- startLine = 2.0f * m_axisCacheY.min() / m_heightNormalizer;
-
GLfloat gridStep = (2.0f * m_axisCacheY.subSegmentStep()) / m_heightNormalizer;
- GLfloat gridPos = startLine + barPosYAdjustment;
+ GLfloat gridPos = barPosYAdjustment;
int lastSegment = m_axisCacheY.subSegmentCount() * m_axisCacheY.segmentCount();
+ // Use the position of the bottom grid line as the base y position for bar labels
// Horizontal lines
if (m_axisCacheY.segmentCount() > 0) {
@@ -365,7 +396,8 @@ void Bars3DRenderer::drawSlicedScene()
// Draw the object
m_drawer->drawObject(lineShader, m_gridLineObj);
- if (gridPos == barPosYAdjustment)
+ // Check if we have a line at zero position already
+ if (gridPos == (barPosYAdjustment + zeroPosAdjustment))
noZero = false;
gridPos += gridStep;
@@ -373,7 +405,7 @@ void Bars3DRenderer::drawSlicedScene()
// Draw a line at zero, if none exists
if (!m_noZeroInRange && noZero) {
QMatrix4x4 modelMatrix;
- modelMatrix.translate(0.0f, barPosYAdjustment, 0.0f);
+ modelMatrix.translate(0.0f, barPosYAdjustment - zeroPosAdjustment, 0.0f);
modelMatrix.scale(gridLineScale);
itModelMatrix = modelMatrix;
MVPMatrix = projectionViewMatrix * modelMatrix;
@@ -391,7 +423,6 @@ void Bars3DRenderer::drawSlicedScene()
}
}
- // TODO: Make user controllable (QTRD-2546)
if (sliceGridLabels) {
// Bind label shader
m_labelShader->bind();
@@ -404,7 +435,7 @@ void Bars3DRenderer::drawSlicedScene()
int labelNbr = 0;
int labelCount = m_axisCacheY.labels().size();
gridStep = (2.0f * m_axisCacheY.segmentStep()) / m_heightNormalizer;
- gridPos = startLine + barPosYAdjustment;
+ gridPos = barPosYAdjustment;
QVector3D backLabelRotation(0.0f, 0.0f, 0.0f);
QVector3D labelTrans = QVector3D(scaleFactor + labelMargin, 0.0f, 0.0f);
@@ -428,26 +459,28 @@ void Bars3DRenderer::drawSlicedScene()
}
// Draw bars
- QVector3D modelMatrixScaler(m_scaleX, 0.0f, m_scaleZ);
- if (rowMode)
- modelMatrixScaler.setX(m_scaleX * m_seriesScale);
- else
- modelMatrixScaler.setZ(m_scaleZ * m_seriesScale);
+ QVector3D modelMatrixScaler(m_scaleX * m_seriesScaleX, 0.0f, m_scaleZ * m_seriesScaleZ);
+ if (!rowMode) {
+ modelMatrixScaler.setX(m_scaleZ * m_seriesScaleZ);
+ modelMatrixScaler.setZ(m_scaleX * m_seriesScaleX);
+ }
// Set common bar shader bindings
m_barShader->bind();
m_barShader->setUniformValue(m_barShader->lightP(), lightPos);
m_barShader->setUniformValue(m_barShader->view(), viewMatrix);
- m_barShader->setUniformValue(m_barShader->lightS(), 0.5f);
+ m_barShader->setUniformValue(m_barShader->lightS(), 0.15f);
m_barShader->setUniformValue(m_barShader->ambientS(),
- m_cachedTheme->ambientLightStrength() * 2.0f);
+ m_cachedTheme->ambientLightStrength() * 2.3f);
+ m_barShader->setUniformValue(m_barShader->lightColor(), lightColor);
m_barGradientShader->bind();
m_barGradientShader->setUniformValue(m_barGradientShader->lightP(), lightPos);
m_barGradientShader->setUniformValue(m_barGradientShader->view(), viewMatrix);
- m_barGradientShader->setUniformValue(m_barGradientShader->lightS(), 0.5f);
+ m_barGradientShader->setUniformValue(m_barGradientShader->lightS(), 0.15f);
m_barGradientShader->setUniformValue(m_barGradientShader->ambientS(),
- m_cachedTheme->ambientLightStrength() * 2.0f);
+ m_cachedTheme->ambientLightStrength() * 2.3f);
m_barGradientShader->setUniformValue(m_barGradientShader->gradientMin(), 0.0f);
+ m_barGradientShader->setUniformValue(m_barGradientShader->lightColor(), lightColor);
// Default to uniform shader
ShaderHelper *barShader = m_barShader;
@@ -457,10 +490,10 @@ void Bars3DRenderer::drawSlicedScene()
Q3DTheme::ColorStyle previousColorStyle = Q3DTheme::ColorStyleUniform;
Q3DTheme::ColorStyle colorStyle = Q3DTheme::ColorStyleUniform;
ObjectHelper *barObj = 0;
- QVector3D barHighlightColor;
- QVector3D rowHighlightColor;
- GLuint barGradientTexture = 0;
- GLuint rowGradientTexture = 0;
+ QVector3D highlightColor;
+ QVector3D baseColor;
+ GLuint highlightGradientTexture = 0;
+ GLuint baseGradientTexture = 0;
const SeriesRenderCache *currentSeries = 0;
bool colorStyleIsUniform = true;
@@ -470,6 +503,8 @@ void Bars3DRenderer::drawSlicedScene()
if (!item)
continue;
+ QQuaternion seriesRotation;
+
if (item->seriesIndex() != currentSeriesIndex) {
currentSeriesIndex = item->seriesIndex();
currentSeries = &(m_visibleSeriesList.at(currentSeriesIndex));
@@ -477,11 +512,11 @@ void Bars3DRenderer::drawSlicedScene()
colorStyle = currentSeries->colorStyle();
colorStyleIsUniform = (colorStyle == Q3DTheme::ColorStyleUniform);
if (colorStyleIsUniform) {
- barHighlightColor = currentSeries->singleHighlightColor();
- rowHighlightColor = currentSeries->multiHighlightColor();
+ highlightColor = currentSeries->singleHighlightColor();
+ baseColor = currentSeries->baseColor();
} else {
- barGradientTexture = currentSeries->singleHighlightGradientTexture();
- rowGradientTexture = currentSeries->multiHighlightGradientTexture();
+ highlightGradientTexture = currentSeries->singleHighlightGradientTexture();
+ baseGradientTexture = currentSeries->baseGradientTexture();
}
// Rebind shader if it has changed
@@ -500,6 +535,7 @@ void Bars3DRenderer::drawSlicedScene()
}
previousColorStyle = colorStyle;
+ seriesRotation = currentSeries->meshRotation();
}
if (item->height() < 0)
@@ -510,20 +546,27 @@ void Bars3DRenderer::drawSlicedScene()
QMatrix4x4 MVPMatrix;
QMatrix4x4 modelMatrix;
QMatrix4x4 itModelMatrix;
- GLfloat barRotation = 0.0f;
- GLfloat barPosY = item->translation().y() + barPosYAdjustment;
+ QQuaternion barRotation = item->rotation();
+ GLfloat barPosY = item->translation().y() + barPosYAdjustment - zeroPosAdjustment;
if (rowMode) {
barPosX = item->translation().x();
} else {
barPosX = -(item->translation().z()); // flip z; frontmost bar to the left
- barRotation = 90.0f;
+ barRotation *= ninetyDegreeRotation;
}
modelMatrix.translate(barPosX, barPosY, 0.0f);
modelMatrixScaler.setY(item->height());
- modelMatrix.rotate(barRotation, 0.0f, 1.0f, 0.0f);
- itModelMatrix.rotate(barRotation, 0.0f, 1.0f, 0.0f);
+
+ if (!seriesRotation.isIdentity())
+ barRotation *= seriesRotation;
+
+ if (!barRotation.isIdentity()) {
+ modelMatrix.rotate(barRotation);
+ itModelMatrix.rotate(barRotation);
+ }
+
modelMatrix.scale(modelMatrixScaler);
itModelMatrix.scale(modelMatrixScaler);
@@ -535,14 +578,14 @@ void Bars3DRenderer::drawSlicedScene()
if (itemMode && m_visualSelectedBarPos.x() == item->position().x()
&& m_visualSelectedBarPos.y() == item->position().y()) {
if (colorStyleIsUniform)
- barColor = barHighlightColor;
+ barColor = highlightColor;
else
- gradientTexture = barGradientTexture;
+ gradientTexture = highlightGradientTexture;
} else {
if (colorStyleIsUniform)
- barColor = rowHighlightColor;
+ barColor = baseColor;
else
- gradientTexture = rowGradientTexture;
+ gradientTexture = baseGradientTexture;
}
if (item->height() != 0) {
@@ -578,66 +621,79 @@ void Bars3DRenderer::drawSlicedScene()
QVector3D positionComp(0.0f, m_autoScaleAdjustment, 0.0f);
// Draw labels for bars
- QVector3D valuePositionComp = zeroVector;
- if (!m_hasNegativeValues)
- valuePositionComp.setY(2.0f);
- else if (m_noZeroInRange)
- valuePositionComp.setY(-2.0f);
QVector3D sliceValueRotation(0.0f, 0.0f, 90.0f);
QVector3D sliceLabelRotation(0.0f, 0.0f, -45.0f);
+ int lastLabel = m_sliceCache->labelItems().size() - 1;
+
+ for (int labelNo = 0; labelNo <= lastLabel; labelNo++) {
+ // Get labels from first series only
+ BarRenderItem *item = m_sliceSelection.at(labelNo);
+ m_dummyBarRenderItem.setTranslation(QVector3D(item->translation().x(),
+ barLabelYPos,
+ item->translation().z()));
+ // Draw labels
+ m_drawer->drawLabel(m_dummyBarRenderItem, *m_sliceCache->labelItems().at(labelNo),
+ viewMatrix, projectionMatrix, positionComp, sliceLabelRotation,
+ 0, m_cachedSelectionMode, m_labelShader,
+ m_labelObj, activeCamera, false, false, Drawer::LabelMid,
+ Qt::AlignRight, true);
+ }
+
for (int col = 0; col < sliceItemCount; col++) {
BarRenderItem *item = m_sliceSelection.at(col);
- // TODO: Make user controllable (QTRD-2546)
if (!sliceGridLabels) {
// Draw values
if (item->height() != 0.0f || (!m_noZeroInRange && item->value() == 0.0f)) {
// Create label texture if we need it
- if (item->sliceLabel().isNull()) {
- item->setSliceLabel(generateValueLabel(m_axisCacheY.labelFormat(), item->value()));
+ if (item->sliceLabel().isNull() || m_updateLabels) {
+ item->setSliceLabel(generateValueLabel(m_axisCacheY.labelFormat(),
+ item->value()));
m_drawer->generateLabelItem(item->sliceLabelItem(), item->sliceLabel());
+ m_updateLabels = false;
}
- m_drawer->drawLabel(*item, item->sliceLabelItem(), viewMatrix, projectionMatrix,
- valuePositionComp, sliceValueRotation, item->height(),
- m_cachedSelectionMode, m_labelShader, m_labelObj, activeCamera,
- false, false, Drawer::LabelOver, Qt::AlignTop, true);
+ Qt::AlignmentFlag alignment = (item->height() < 0) ? Qt::AlignBottom : Qt::AlignTop;
+ Drawer::LabelPosition labelPos = (item->height() < 0) ? Drawer::LabelBelow : Drawer::LabelOver;
+ m_dummyBarRenderItem.setTranslation(QVector3D(item->translation().x(),
+ barPosYAdjustment - zeroPosAdjustment
+ + item->height(),
+ item->translation().z()));
+
+ m_drawer->drawLabel(m_dummyBarRenderItem, item->sliceLabelItem(), viewMatrix,
+ projectionMatrix, zeroVector, sliceValueRotation,
+ item->height(), m_cachedSelectionMode, m_labelShader,
+ m_labelObj, activeCamera, false, false, labelPos,
+ alignment, true);
}
} else {
// Only draw value for selected item when grid labels are on
- // TODO: Maybe use selection label instead of value? Should it be user controllable
- // as well? (QTRD-2546)
if (itemMode && m_visualSelectedBarPos.x() == item->position().x()
&& m_visualSelectedBarPos.y() == item->position().y()
&& item->seriesIndex() == m_visualSelectedBarSeriesIndex) {
// Create label texture if we need it
- if (item->sliceLabel().isNull()) {
- item->setSliceLabel(generateValueLabel(m_axisCacheY.labelFormat(), item->value()));
+ if (item->sliceLabel().isNull() || m_updateLabels) {
+ item->setSliceLabel(generateValueLabel(m_axisCacheY.labelFormat(),
+ item->value()));
m_drawer->generateLabelItem(item->sliceLabelItem(), item->sliceLabel());
+ m_updateLabels = false;
}
- m_drawer->drawLabel(*item, item->sliceLabelItem(), viewMatrix, projectionMatrix,
- valuePositionComp, sliceValueRotation, item->height(),
- m_cachedSelectionMode, m_labelShader, m_labelObj, activeCamera,
- false, false, Drawer::LabelOver, Qt::AlignTop, true);
+ Qt::AlignmentFlag alignment = (item->height() < 0) ? Qt::AlignBottom : Qt::AlignTop;
+ Drawer::LabelPosition labelPos = (item->height() < 0) ? Drawer::LabelBelow : Drawer::LabelOver;
+ m_dummyBarRenderItem.setTranslation(QVector3D(item->translation().x(),
+ barPosYAdjustment - zeroPosAdjustment
+ + item->height(),
+ item->translation().z()));
+
+ m_drawer->drawLabel(m_dummyBarRenderItem, item->sliceLabelItem(), viewMatrix,
+ projectionMatrix, zeroVector, sliceValueRotation,
+ item->height(), m_cachedSelectionMode, m_labelShader,
+ m_labelObj, activeCamera, false, false, labelPos,
+ alignment, true);
}
}
}
- int lastLabel = m_sliceCache->labelItems().size() - 1;
-
- for (int labelNo = 0; labelNo <= lastLabel; labelNo++) {
- // Get labels from first series only
- BarRenderItem *item = m_sliceSelection.at(labelNo);
- // TODO: Make user controllable (QTRD-2546)
- // Draw labels
- m_drawer->drawLabel(*item, *m_sliceCache->labelItems().at(labelNo), viewMatrix,
- projectionMatrix, positionComp, sliceLabelRotation,
- item->height(), m_cachedSelectionMode, m_labelShader,
- m_labelObj, activeCamera, false, false, Drawer::LabelBelow,
- Qt::AlignCenter, true);
- }
-
- // TODO: Make user controllable (QTRD-2546)
// Draw labels for axes
if (rowMode) {
if (m_sliceTitleItem) {
@@ -662,10 +718,13 @@ void Bars3DRenderer::drawSlicedScene()
Qt::AlignCenter, true);
}
}
- m_drawer->drawLabel(*dummyItem, m_axisCacheY.titleItem(), viewMatrix, projectionMatrix,
- positionComp, QVector3D(0.0f, 0.0f, 90.0f), 0,
+ // Y-axis label
+ QVector3D labelTrans = QVector3D(-scaleFactor - labelMargin, 0.2f, 0.0f); // y = 0.2 for row/column labels (see barPosYAdjustment)
+ m_dummyBarRenderItem.setTranslation(labelTrans);
+ m_drawer->drawLabel(m_dummyBarRenderItem, m_axisCacheY.titleItem(), viewMatrix,
+ projectionMatrix, zeroVector, QVector3D(0.0f, 0.0f, 90.0f), 0,
m_cachedSelectionMode, m_labelShader, m_labelObj, activeCamera,
- false, false, Drawer::LabelLeft, Qt::AlignCenter, true);
+ false, false, Drawer::LabelMid, Qt::AlignHCenter);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
@@ -690,6 +749,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
GLfloat colPos = 0;
GLfloat rowPos = 0;
+ QVector3D lightColor = Utils::vectorFromColor(m_cachedTheme->lightColor());
+
int seriesCount = m_visibleSeriesList.size();
const Q3DCamera *activeCamera = m_cachedScene->activeCamera();
@@ -701,7 +762,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
// Set up projection matrix
QMatrix4x4 projectionMatrix;
- GLfloat viewPortRatio = (GLfloat)m_primarySubViewport.width() / (GLfloat)m_primarySubViewport.height();
+ GLfloat viewPortRatio = (GLfloat)m_primarySubViewport.width()
+ / (GLfloat)m_primarySubViewport.height();
projectionMatrix.perspective(45.0f, viewPortRatio, 0.1f, 100.0f);
// Get the view matrix
@@ -760,10 +822,10 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
QMatrix4x4 projectionViewMatrix = projectionMatrix * viewMatrix;
- bool rowMode = m_cachedSelectionMode.testFlag(QDataVis::SelectionRow);
+ bool rowMode = m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Render scene into a depth texture for using with shadow mapping
// Enable drawing to depth framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, m_depthFrameBuffer);
@@ -784,19 +846,17 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
zeroVector, 0.0f, 3.5f / m_autoScaleAdjustment);
depthViewMatrix.lookAt(depthLightPos, zeroVector, upVector);
- // TODO: Why does depthViewMatrix.column(3).y() goes to zero when we're directly above?
- // That causes the scene to be not drawn from above -> must be fixed
- // qDebug() << lightPos << depthViewMatrix << depthViewMatrix.column(3);
-
// Set the depth projection matrix
depthProjectionMatrix.perspective(10.0f, viewPortRatio, 3.0f, 100.0f);
depthProjectionViewMatrix = depthProjectionMatrix * depthViewMatrix;
// Draw bars to depth buffer
- QVector3D shadowScaler(m_scaleX * m_seriesScale * 0.9f, 0.0f, m_scaleZ * 0.9f);
+ QVector3D shadowScaler(m_scaleX * m_seriesScaleX * 0.9f, 0.0f,
+ m_scaleZ * m_seriesScaleZ * 0.9f);
float seriesPos = m_seriesStart;
for (int series = 0; series < seriesCount; series++) {
ObjectHelper *barObj = m_visibleSeriesList.at(series).object();
+ QQuaternion seriesRotation(m_visibleSeriesList.at(series).meshRotation());
for (int row = startRow; row != stopRow; row += stepRow) {
for (int bar = startBar; bar != stopBar; bar += stepBar) {
GLfloat shadowOffset = 0.0f;
@@ -828,6 +888,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
(m_columnDepth - rowPos) / m_scaleFactor);
// Scale the bars down in X and Z to reduce self-shadowing issues
shadowScaler.setY(item.height());
+ if (!seriesRotation.isIdentity() || !item.rotation().isIdentity())
+ modelMatrix.rotate(seriesRotation * item.rotation());
modelMatrix.scale(shadowScaler);
MVPMatrix = depthProjectionViewMatrix * modelMatrix;
@@ -860,19 +922,6 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
// Disable drawing to depth framebuffer (= enable drawing to screen)
glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
-#if 0 // Use this if you want to see what is being drawn to the framebuffer
- // You'll also have to comment out GL_COMPARE_R_TO_TEXTURE -line in texturehelper (if using it)
- m_labelShader->bind();
- glCullFace(GL_BACK);
- glEnable(GL_TEXTURE_2D);
- QMatrix4x4 modelMatrix;
- QMatrix4x4 viewmatrix;
- viewmatrix.lookAt(QVector3D(0.0f, 0.0f, 2.5f), zeroVector, upVector);
- QMatrix4x4 MVPMatrix = projectionViewMatrix * modelMatrix;
- m_labelShader->setUniformValue(m_labelShader->MVP(), MVPMatrix);
- m_drawer->drawObject(m_labelShader, m_labelObj, m_depthTexture);
- glDisable(GL_TEXTURE_2D);
-#endif
// Reset culling to normal
glCullFace(GL_BACK);
@@ -884,9 +933,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
#endif
- // TODO: Selection must be enabled currently to support clicked signal. (QTRD-2517)
// Skip selection mode drawing if we're slicing or have no selection mode
- if (!m_cachedIsSlicingActivated && m_cachedSelectionMode > QDataVis::SelectionNone
+ if (!m_cachedIsSlicingActivated && m_cachedSelectionMode > QAbstract3DGraph::SelectionNone
&& m_selectionState == SelectOnScene && seriesCount > 0) {
// Bind selection shader
m_selectionShader->bind();
@@ -904,6 +952,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
float seriesPos = m_seriesStart;
for (int series = 0; series < seriesCount; series++) {
ObjectHelper *barObj = m_visibleSeriesList.at(series).object();
+ QQuaternion seriesRotation(m_visibleSeriesList.at(series).meshRotation());
for (int row = startRow; row != stopRow; row += stepRow) {
for (int bar = startBar; bar != stopBar; bar += stepBar) {
const BarRenderItem &item = m_renderingArrays.at(series).at(row).at(bar);
@@ -924,21 +973,17 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
modelMatrix.translate((colPos - m_rowWidth) / m_scaleFactor,
item.height(),
(m_columnDepth - rowPos) / m_scaleFactor);
- modelMatrix.scale(QVector3D(m_scaleX * m_seriesScale,
+ if (!seriesRotation.isIdentity() || !item.rotation().isIdentity())
+ modelMatrix.rotate(seriesRotation * item.rotation());
+ modelMatrix.scale(QVector3D(m_scaleX * m_seriesScaleX,
item.height(),
- m_scaleZ));
+ m_scaleZ * m_seriesScaleZ));
MVPMatrix = projectionViewMatrix * modelMatrix;
- //#if !defined(QT_OPENGL_ES_2)
- // QVector3D barColor = QVector3D(GLfloat(row) / 32767.0f,
- // GLfloat(bar) / 32767.0f,
- // 0.0f);
- //#else
QVector3D barColor = QVector3D(GLfloat(row) / 255.0f,
GLfloat(bar) / 255.0f,
GLfloat(series) / 255.0f);
- //#endif
m_selectionShader->setUniformValue(m_selectionShader->MVP(), MVPMatrix);
m_selectionShader->setUniformValue(m_selectionShader->color(), barColor);
@@ -970,7 +1015,10 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
// Read color under cursor
QVector3D clickedColor = Utils::getSelection(m_inputPosition,
m_viewport.height());
- emit barClicked(selectionColorToArrayPosition(clickedColor), selectionColorToSeries(clickedColor));
+ m_clickedPosition = selectionColorToArrayPosition(clickedColor);
+ m_clickedSeries = selectionColorToSeries(clickedColor);
+
+ emit needRender();
// Revert to original render target and viewport
glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
@@ -1004,6 +1052,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_barGradientShader->setUniformValue(m_barGradientShader->ambientS(),
m_cachedTheme->ambientLightStrength());
m_barGradientShader->setUniformValue(m_barGradientShader->gradientMin(), 0.0f);
+ m_barGradientShader->setUniformValue(m_barGradientShader->lightColor(), lightColor);
}
if (haveUniformColorSeries) {
@@ -1012,6 +1061,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_barShader->setUniformValue(m_barShader->view(), viewMatrix);
m_barShader->setUniformValue(m_barShader->ambientS(),
m_cachedTheme->ambientLightStrength());
+ m_barShader->setUniformValue(m_barShader->lightColor(), lightColor);
barShader = m_barShader;
} else {
barShader = m_barGradientShader;
@@ -1026,7 +1076,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
reserveAmount = m_cachedColumnCount;
else
reserveAmount = m_cachedRowCount;
- if (m_cachedSelectionMode.testFlag(QDataVis::SelectionMultiSeries))
+ if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionMultiSeries))
reserveAmount *= m_visibleSeriesList.size();
m_sliceSelection.resize(reserveAmount);
@@ -1048,11 +1098,12 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
QVector3D baseColor;
QVector3D barColor;
- QVector3D modelScaler(m_scaleX * m_seriesScale, 0.0f, m_scaleZ);
+ QVector3D modelScaler(m_scaleX * m_seriesScaleX, 0.0f, m_scaleZ * m_seriesScaleZ);
bool somethingSelected = (m_visualSelectedBarPos != Bars3DController::invalidSelectionPosition());
float seriesPos = m_seriesStart;
for (int series = 0; series < seriesCount; series++) {
const SeriesRenderCache &currentSeries = m_visibleSeriesList.at(series);
+ QQuaternion seriesRotation(currentSeries.meshRotation());
ObjectHelper *barObj = currentSeries.object();
Q3DTheme::ColorStyle colorStyle = currentSeries.colorStyle();
bool colorStyleIsUniform = (colorStyle == Q3DTheme::ColorStyleUniform);
@@ -1074,7 +1125,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
// Always use base color when no selection mode
- if (m_cachedSelectionMode == QDataVis::SelectionNone) {
+ if (m_cachedSelectionMode == QAbstract3DGraph::SelectionNone) {
if (colorStyleIsUniform)
barColor = baseColor;
else
@@ -1085,7 +1136,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
int sliceSeriesAdjust = 0;
if (m_selectionDirty && m_cachedIsSlicingActivated) {
int seriesMultiplier = 0;
- if (m_cachedSelectionMode.testFlag(QDataVis::SelectionMultiSeries))
+ if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionMultiSeries))
seriesMultiplier = series;
if (rowMode)
sliceSeriesAdjust = seriesMultiplier * m_cachedColumnCount;
@@ -1113,6 +1164,11 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
item.height(),
(m_columnDepth - rowPos) / m_scaleFactor);
modelScaler.setY(item.height());
+ if (!seriesRotation.isIdentity() || !item.rotation().isIdentity()) {
+ QQuaternion totalRotation = seriesRotation * item.rotation();
+ modelMatrix.rotate(totalRotation);
+ itModelMatrix.rotate(totalRotation);
+ }
modelMatrix.scale(modelScaler);
itModelMatrix.scale(modelScaler);
#ifdef SHOW_DEPTH_TEXTURE_SCENE
@@ -1123,7 +1179,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
GLfloat lightStrength = m_cachedTheme->lightStrength();
GLfloat shadowLightStrength = adjustedLightStrength;
- if (m_cachedSelectionMode > QDataVis::SelectionNone) {
+ if (m_cachedSelectionMode > QAbstract3DGraph::SelectionNone) {
Bars3DController::SelectionType selectionType = Bars3DController::SelectionNone;
if (somethingSelected)
selectionType = isSelected(row, bar, series);
@@ -1138,7 +1194,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lightStrength = m_cachedTheme->highlightLightStrength();
shadowLightStrength = adjustedHighlightStrength;
// Insert position data into render item. We have no ownership, don't delete the previous one
- if (!m_cachedIsSlicingActivated && m_visualSelectedBarSeriesIndex == series) {
+ if (!m_cachedIsSlicingActivated
+ && m_visualSelectedBarSeriesIndex == series) {
selectedBar = &item;
selectedBar->setPosition(QPoint(row, bar));
item.setTranslation(modelMatrix.column(3).toVector3D());
@@ -1146,7 +1203,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
if (m_selectionDirty && m_cachedIsSlicingActivated) {
QVector3D translation = modelMatrix.column(3).toVector3D();
- if (m_cachedSelectionMode & QDataVis::SelectionColumn
+ if (m_cachedSelectionMode & QAbstract3DGraph::SelectionColumn
&& seriesCount > 1) {
translation.setZ((m_columnDepth - ((row + 0.5f + seriesPos)
* (m_cachedBarSpacing.height())))
@@ -1236,12 +1293,13 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
barShader->setUniformValue(barShader->shadowQ(), m_shadowQualityToShader);
barShader->setUniformValue(barShader->depth(), depthMVPMatrix);
barShader->setUniformValue(barShader->lightS(), shadowLightStrength);
+ barShader->setUniformValue(barShader->lightColor(), lightColor);
// Draw the object
m_drawer->drawObject(barShader, barObj, gradientTexture, m_depthTexture);
@@ -1304,9 +1362,10 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_backgroundShader->setUniformValue(m_backgroundShader->color(), backgroundColor);
m_backgroundShader->setUniformValue(m_backgroundShader->ambientS(),
m_cachedTheme->ambientLightStrength() * 2.0f);
+ m_backgroundShader->setUniformValue(m_backgroundShader->lightColor(), lightColor);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
m_backgroundShader->setUniformValue(m_backgroundShader->shadowQ(),
@@ -1354,7 +1413,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_backgroundShader->setUniformValue(m_backgroundShader->MVP(), MVPMatrix);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
m_backgroundShader->setUniformValue(m_backgroundShader->depth(), depthMVPMatrix);
@@ -1375,7 +1434,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
// Draw grid lines
if (m_cachedTheme->isGridEnabled() && m_heightNormalizer) {
ShaderHelper *lineShader = m_backgroundShader;
- QQuaternion lineRotation = QQuaternion();
+ QQuaternion lineRotation;
// Bind bar shader
lineShader->bind();
@@ -1386,8 +1445,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lineShader->setUniformValue(lineShader->view(), viewMatrix);
lineShader->setUniformValue(lineShader->color(), barColor);
lineShader->setUniformValue(lineShader->ambientS(), m_cachedTheme->ambientLightStrength());
+ lineShader->setUniformValue(lineShader->lightColor(), lightColor);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadowed shader bindings
lineShader->setUniformValue(lineShader->shadowQ(), m_shadowQualityToShader);
lineShader->setUniformValue(lineShader->lightS(),
@@ -1396,7 +1456,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
#endif
{
// Set shadowless shader bindings
- lineShader->setUniformValue(lineShader->lightS(), m_cachedTheme->lightStrength() / 2.5f);
+ lineShader->setUniformValue(lineShader->lightS(),
+ m_cachedTheme->lightStrength() / 2.5f);
}
GLfloat yFloorLinePosition = 0.0f;
@@ -1435,7 +1496,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
@@ -1473,7 +1534,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
@@ -1530,7 +1591,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
@@ -1579,7 +1640,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
// Set shadow shader bindings
QMatrix4x4 depthMVPMatrix = depthProjectionViewMatrix * modelMatrix;
lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
@@ -1625,7 +1686,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
for (int row = 0; row != m_cachedRowCount; row++) {
if (m_axisCacheZ.labelItems().size() > row) {
// Go through all rows and get position of max+1 or min-1 column, depending on x flip
- // We need only positions for them, labels have already been generated at QDataSetPrivate. Just add LabelItems
+ // We need only positions for them, labels have already been generated
rowPos = (row + 0.5f) * m_cachedBarSpacing.height();
if (m_xFlipped)
colPos = -colPosValue;
@@ -1662,7 +1723,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
for (int column = 0; column != m_cachedColumnCount; column++) {
if (m_axisCacheX.labelItems().size() > column) {
// Go through all columns and get position of max+1 or min-1 row, depending on z flip
- // We need only positions for them, labels have already been generated at QDataSetPrivate. Just add LabelItems
+ // We need only positions for them, labels have already been generated
colPos = (column + 0.5f) * m_cachedBarSpacing.width();
if (m_zFlipped)
rowPos = -rowPosValue;
@@ -1756,9 +1817,10 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
glDisable(GL_DEPTH_TEST);
// Draw the selection label
LabelItem &labelItem = selectedBar->selectionLabelItem();
- if (m_selectedBar != selectedBar || m_updateLabels || !labelItem.textureId()) {
+ if (m_selectedBar != selectedBar || m_updateLabels || !labelItem.textureId()
+ || m_selectionLabelDirty) {
QString labelText = selectedBar->selectionLabel();
- if (labelText.isNull()) {
+ if (labelText.isNull() || m_selectionLabelDirty) {
static const QString rowIndexTag(QStringLiteral("@rowIdx"));
static const QString rowLabelTag(QStringLiteral("@rowLabel"));
static const QString rowTitleTag(QStringLiteral("@rowTitle"));
@@ -1767,6 +1829,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
static const QString colTitleTag(QStringLiteral("@colTitle"));
static const QString valueTitleTag(QStringLiteral("@valueTitle"));
static const QString valueLabelTag(QStringLiteral("@valueLabel"));
+ static const QString seriesNameTag(QStringLiteral("@seriesName"));
// Custom format expects printf format specifier. There is no tag for it.
labelText = generateValueLabel(
@@ -1797,7 +1860,11 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
labelText.replace(valueLabelTag, valueLabelText);
}
+ labelText.replace(seriesNameTag,
+ m_visibleSeriesList[m_visualSelectedBarSeriesIndex].name());
+
selectedBar->setSelectionLabel(labelText);
+ m_selectionLabelDirty = false;
}
m_drawer->generateLabelItem(labelItem, labelText);
m_selectedBar = selectedBar;
@@ -1825,6 +1892,18 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_selectionDirty = false;
}
+void Bars3DRenderer::updateMultiSeriesScaling(bool uniform)
+{
+ m_keepSeriesUniform = uniform;
+
+ // Recalculate scale factors
+ m_seriesScaleX = 1.0f / float(m_visibleSeriesList.size());
+ if (m_keepSeriesUniform)
+ m_seriesScaleZ = m_seriesScaleX;
+ else
+ m_seriesScaleZ = 1.0f;
+}
+
void Bars3DRenderer::updateBarSpecs(GLfloat thicknessRatio, const QSizeF &spacing, bool relative)
{
// Convert ratio to QSizeF, as we need it in that format for autoscaling calculations
@@ -1848,12 +1927,12 @@ void Bars3DRenderer::updateBarSpecs(GLfloat thicknessRatio, const QSizeF &spacin
calculateSceneScalingFactors();
}
-void Bars3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min,
+void Bars3DRenderer::updateAxisRange(QAbstract3DAxis::AxisOrientation orientation, float min,
float max)
{
Abstract3DRenderer::updateAxisRange(orientation, min, max);
- if (orientation == Q3DAbstractAxis::AxisOrientationY) {
+ if (orientation == QAbstract3DAxis::AxisOrientationY) {
calculateHeightAdjustment();
// Check if we have negative values
if (min < 0 && !m_hasNegativeValues) {
@@ -1903,31 +1982,37 @@ void Bars3DRenderer::updateSelectedBar(const QPoint &position, const QBar3DSerie
}
}
-void Bars3DRenderer::updateShadowQuality(QDataVis::ShadowQuality quality)
+void Bars3DRenderer::resetClickedStatus()
+{
+ m_clickedPosition = Bars3DController::invalidSelectionPosition();
+ m_clickedSeries = 0;
+}
+
+void Bars3DRenderer::updateShadowQuality(QAbstract3DGraph::ShadowQuality quality)
{
m_cachedShadowQuality = quality;
switch (quality) {
- case QDataVis::ShadowQualityLow:
+ case QAbstract3DGraph::ShadowQualityLow:
m_shadowQualityToShader = 33.3f;
m_shadowQualityMultiplier = 1;
break;
- case QDataVis::ShadowQualityMedium:
+ case QAbstract3DGraph::ShadowQualityMedium:
m_shadowQualityToShader = 100.0f;
m_shadowQualityMultiplier = 3;
break;
- case QDataVis::ShadowQualityHigh:
+ case QAbstract3DGraph::ShadowQualityHigh:
m_shadowQualityToShader = 200.0f;
m_shadowQualityMultiplier = 5;
break;
- case QDataVis::ShadowQualitySoftLow:
+ case QAbstract3DGraph::ShadowQualitySoftLow:
m_shadowQualityToShader = 7.5f;
m_shadowQualityMultiplier = 1;
break;
- case QDataVis::ShadowQualitySoftMedium:
+ case QAbstract3DGraph::ShadowQualitySoftMedium:
m_shadowQualityToShader = 10.0f;
m_shadowQualityMultiplier = 3;
break;
- case QDataVis::ShadowQualitySoftHigh:
+ case QAbstract3DGraph::ShadowQualitySoftHigh:
m_shadowQualityToShader = 15.0f;
m_shadowQualityMultiplier = 4;
break;
@@ -1982,7 +2067,7 @@ void Bars3DRenderer::fixMeshFileName(QString &fileName, QAbstract3DSeries::Mesh
{
if (!m_cachedTheme->isBackgroundEnabled()) {
// Load full version of meshes that have it available
- // Note: Minimal and Point not supported in bar charts
+ // Note: Minimal, Point, and Arrow not supported in bar charts
if (mesh != QAbstract3DSeries::MeshSphere)
fileName.append(QStringLiteral("Full"));
}
@@ -2035,17 +2120,17 @@ Bars3DController::SelectionType Bars3DRenderer::isSelected(int row, int bar, int
{
Bars3DController::SelectionType isSelectedType = Bars3DController::SelectionNone;
- if ((m_cachedSelectionMode.testFlag(QDataVis::SelectionMultiSeries)
+ if ((m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionMultiSeries)
&& m_visualSelectedBarSeriesIndex >= 0)
|| seriesIndex == m_visualSelectedBarSeriesIndex) {
if (row == m_visualSelectedBarPos.x() && bar == m_visualSelectedBarPos.y()
- && (m_cachedSelectionMode.testFlag(QDataVis::SelectionItem))) {
+ && (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionItem))) {
isSelectedType = Bars3DController::SelectionItem;
} else if (row == m_visualSelectedBarPos.x()
- && (m_cachedSelectionMode.testFlag(QDataVis::SelectionRow))) {
+ && (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow))) {
isSelectedType = Bars3DController::SelectionRow;
} else if (bar == m_visualSelectedBarPos.y()
- && (m_cachedSelectionMode.testFlag(QDataVis::SelectionColumn))) {
+ && (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionColumn))) {
isSelectedType = Bars3DController::SelectionColumn;
}
}
@@ -2150,7 +2235,7 @@ void Bars3DRenderer::updateDepthBuffer()
if (m_primarySubViewport.size().isEmpty())
return;
- if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
+ if (m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) {
m_depthTexture = m_textureHelper->createDepthTextureFrameBuffer(m_primarySubViewport.size(),
m_depthFrameBuffer,
m_shadowQualityMultiplier);
@@ -2177,4 +2262,4 @@ void Bars3DRenderer::initLabelShaders(const QString &vertexShader, const QString
m_labelShader->initialize();
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/bars3drenderer_p.h b/src/datavisualization/engine/bars3drenderer_p.h
index 16e7a476..e53f9bc5 100644
--- a/src/datavisualization/engine/bars3drenderer_p.h
+++ b/src/datavisualization/engine/bars3drenderer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -26,8 +26,8 @@
//
// We mean it.
-#ifndef Q3DBARSRENDERER_p_H
-#define Q3DBARSRENDERER_p_H
+#ifndef Q3DBARSRENDERER_P_H
+#define Q3DBARSRENDERER_P_H
#include "datavisualizationglobal_p.h"
#include "bars3dcontroller_p.h"
@@ -39,7 +39,7 @@ class QPoint;
class QSizeF;
class QOpenGLShaderProgram;
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class ShaderHelper;
class ObjectHelper;
@@ -102,15 +102,19 @@ private:
BarRenderItem m_dummyBarRenderItem;
QVector<BarRenderItemArray> m_renderingArrays;
bool m_noZeroInRange;
- float m_seriesScale;
+ float m_seriesScaleX;
+ float m_seriesScaleZ;
float m_seriesStep;
float m_seriesStart;
+ QPoint m_clickedPosition;
+ bool m_keepSeriesUniform;
public:
explicit Bars3DRenderer(Bars3DController *controller);
~Bars3DRenderer();
void updateData();
+ void updateSeries(const QList<QAbstract3DSeries *> &seriesList, bool updateVisibility);
void updateScene(Q3DScene *scene);
void render(GLuint defaultFboHandle = 0);
@@ -118,22 +122,23 @@ protected:
virtual void initializeOpenGL();
public slots:
+ void updateMultiSeriesScaling(bool uniform);
void updateBarSpecs(GLfloat thicknessRatio = 1.0f,
const QSizeF &spacing = QSizeF(1.0, 1.0),
bool relative = true);
void updateSlicingActive(bool isSlicing);
void updateSelectedBar(const QPoint &position, const QBar3DSeries *series);
+ inline QPoint clickedPosition() const { return m_clickedPosition; }
+ void resetClickedStatus();
// Overloaded from abstract renderer
- virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max);
-
-signals:
- void barClicked(QPoint position, QBar3DSeries *series);
+ virtual void updateAxisRange(QAbstract3DAxis::AxisOrientation orientation, float min,
+ float max);
private:
virtual void initShaders(const QString &vertexShader, const QString &fragmentShader);
virtual void initGradientShaders(const QString &vertexShader, const QString &fragmentShader);
- virtual void updateShadowQuality(QDataVis::ShadowQuality quality);
+ virtual void updateShadowQuality(QAbstract3DGraph::ShadowQuality quality);
virtual void updateTextures();
virtual void fixMeshFileName(QString &fileName, QAbstract3DSeries::Mesh mesh);
@@ -162,7 +167,6 @@ private:
friend class BarRenderItem;
};
-
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index f78b2d29..dd82eadc 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -16,7 +16,6 @@
**
****************************************************************************/
-#include "qdatavisualizationenums.h"
#include "drawer_p.h"
#include "shaderhelper_p.h"
#include "objecthelper_p.h"
@@ -39,15 +38,13 @@ public:
};
StaticLibInitializer staticLibInitializer;
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
// Vertex array buffer for point
const GLfloat point_data[] = {0.0f, 0.0f, 0.0f};
Drawer::Drawer(Q3DTheme *theme)
: m_theme(theme),
- m_font(theme->font()),
- m_labelBackground(theme->isLabelBackgroundEnabled()),
m_textureHelper(0),
m_pointbuffer(0)
{
@@ -71,8 +68,6 @@ void Drawer::initializeOpenGL()
void Drawer::setTheme(Q3DTheme *theme)
{
m_theme = theme;
- m_font = m_theme->font();
- m_labelBackground = m_theme->isLabelBackgroundEnabled();
emit drawerChanged();
}
@@ -81,25 +76,9 @@ Q3DTheme *Drawer::theme() const
return m_theme;
}
-void Drawer::setFont(const QFont &font)
-{
- // We need to be able to override theme's font for drawer
- // TODO: (or do we?)
- m_font = font;
- emit drawerChanged();
-}
-
QFont Drawer::font() const
{
- return m_font;
-}
-
-void Drawer::setLabelBackground(bool enabled)
-{
- // We need to be able to override theme's label background for drawer
- // TODO: (or do we?)
- m_labelBackground = enabled;
- emit drawerChanged();
+ return m_theme->font();
}
void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId,
@@ -205,7 +184,7 @@ void Drawer::drawPoint(ShaderHelper *shader)
void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelItem,
const QMatrix4x4 &viewmatrix, const QMatrix4x4 &projectionmatrix,
const QVector3D &positionComp, const QVector3D &rotation,
- GLfloat itemHeight, QDataVis::SelectionFlags mode,
+ GLfloat itemHeight, QAbstract3DGraph::SelectionFlags mode,
ShaderHelper *shader, ObjectHelper *object,
const Q3DCamera *camera, bool useDepth, bool rotateAlong,
LabelPosition position, Qt::AlignmentFlag alignment, bool isSlicing)
@@ -223,7 +202,7 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte
switch (position) {
case LabelBelow: {
- yPosition = -2.6f + positionComp.y(); // minus maximum negative height (+ some extra for axis title label)
+ yPosition = item.translation().y() - (positionComp.y() / 2.0f) + itemHeight - 0.1f;
break;
}
case LabelLow: {
@@ -231,79 +210,96 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte
break;
}
case LabelMid: {
- // Use this for positioning with absolute item y position value
yPosition = item.translation().y();
break;
}
case LabelHigh: {
- // TODO: Fix this. Can't seem to get it right (if ok with positive-only bars, doesn't look good on +- and vice versa)
yPosition = item.translation().y() + itemHeight / 2.0f;
break;
}
case LabelOver: {
- float mod = 0.3f;
- if (itemHeight < 0)
- mod = 0.15f;
- yPosition = item.translation().y() - (positionComp.y() / 2.0f) + itemHeight + mod;
+ yPosition = item.translation().y() - (positionComp.y() / 2.0f) + itemHeight + 0.1f;
break;
}
case LabelBottom: {
- yPosition = -2.95f + positionComp.y();
+ yPosition = -2.75f + positionComp.y();
xPosition = 0.0f;
break;
}
case LabelTop: {
- yPosition = 2.95f - positionComp.y();
+ yPosition = 2.75f - positionComp.y();
xPosition = 0.0f;
break;
}
case LabelLeft: {
yPosition = 0.0f;
- xPosition = -2.95f;
+ xPosition = -2.75f;
break;
}
case LabelRight: {
yPosition = 0.0f;
- xPosition = 2.95f;
+ xPosition = 2.75f;
break;
}
}
// Calculate scale factor to get uniform font size
- GLfloat scaledFontSize = 0.05f + m_font.pointSizeF() / 500.0f;
+ GLfloat scaledFontSize = 0.05f + m_theme->font().pointSizeF() / 500.0f;
GLfloat scaleFactor = scaledFontSize / (GLfloat)textureSize.height();
// Apply alignment
GLfloat xAlignment = 0.0f;
GLfloat yAlignment = 0.0f;
GLfloat zAlignment = 0.0f;
+ GLfloat sinRotY = qFabs(qSin(qDegreesToRadians(rotation.y())));
+ GLfloat cosRotY = qFabs(qCos(qDegreesToRadians(rotation.y())));
+ GLfloat sinRotZ = 0.0f;
+ GLfloat cosRotZ = 0.0f;
+ if (rotation.z()) {
+ sinRotZ = qFabs(qSin(qDegreesToRadians(rotation.z())));
+ cosRotZ = qFabs(qCos(qDegreesToRadians(rotation.z())));
+ }
switch (alignment) {
case Qt::AlignLeft: {
- xAlignment = (-(GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qCos(qDegreesToRadians(rotation.y())));
- zAlignment = ((GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qSin(qDegreesToRadians(rotation.y())));
+ if (rotation.z() && rotation.z() != 180.0f && !rotation.y()) {
+ xAlignment = ((-(GLfloat)textureSize.width() * scaleFactor) * cosRotZ
+ - ((GLfloat)textureSize.height() * scaleFactor) * sinRotZ) / 2.0f;
+ yAlignment = (((GLfloat)textureSize.width() * scaleFactor) * sinRotZ
+ + ((GLfloat)textureSize.height() * scaleFactor) * cosRotZ) / 2.0f;
+ } else {
+ xAlignment = (-(GLfloat)textureSize.width() * scaleFactor) * cosRotY;
+ zAlignment = ((GLfloat)textureSize.width() * scaleFactor) * sinRotY;
+ }
break;
}
case Qt::AlignRight: {
- xAlignment = ((GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qCos(qDegreesToRadians(rotation.y())));
- zAlignment = (-(GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qSin(qDegreesToRadians(rotation.y())));
+ if (rotation.z() && rotation.z() != 180.0f && !rotation.y()) {
+ xAlignment = (((GLfloat)textureSize.width() * scaleFactor) * cosRotZ
+ + ((GLfloat)textureSize.height() * scaleFactor) * sinRotZ) / 2.0f;
+ yAlignment = (((GLfloat)textureSize.width() * scaleFactor) * sinRotZ
+ + ((GLfloat)textureSize.height() * scaleFactor) * cosRotZ) / 2.0f;
+ } else {
+ xAlignment = ((GLfloat)textureSize.width() * scaleFactor) * cosRotY;
+ zAlignment = (-(GLfloat)textureSize.width() * scaleFactor) * sinRotY;
+ }
break;
}
case Qt::AlignTop: {
- yAlignment = ((GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qCos(qDegreesToRadians(rotation.y())));
- if (itemHeight < 0)
- yAlignment = -yAlignment;
+ yAlignment = ((GLfloat)textureSize.width() * scaleFactor) * cosRotY;
break;
}
case Qt::AlignBottom: {
- yAlignment = (-(GLfloat)textureSize.width() * scaleFactor)
- * qFabs(qCos(qDegreesToRadians(rotation.y())));
- if (itemHeight < 0)
- yAlignment = -yAlignment;
+ yAlignment = (-(GLfloat)textureSize.width() * scaleFactor) * cosRotY;
+ break;
+ }
+ case Qt::AlignHCenter: {
+ xAlignment = (-(GLfloat)textureSize.width() * scaleFactor) * cosRotZ
+ - ((GLfloat)textureSize.height() * scaleFactor) * sinRotZ;
+ break;
+ }
+ case Qt::AlignVCenter: {
+ yAlignment = ((GLfloat)textureSize.width() * scaleFactor) * cosRotZ
+ + ((GLfloat)textureSize.height() * scaleFactor) * sinRotZ;
break;
}
default: {
@@ -315,7 +311,7 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte
xPosition = item.translation().x();
if (useDepth)
zPosition = item.translation().z();
- else if (mode.testFlag(QDataVis::SelectionColumn) && isSlicing)
+ else if (mode.testFlag(QAbstract3DGraph::SelectionColumn) && isSlicing)
xPosition = -(item.translation().z()) + positionComp.z(); // flip first to left
}
@@ -367,11 +363,11 @@ void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestL
if (!text.isEmpty()) {
// Create labels
// Print label into a QImage using QPainter
- QImage label = Utils::printTextToImage(m_font,
+ QImage label = Utils::printTextToImage(m_theme->font(),
text,
m_theme->labelBackgroundColor(),
m_theme->labelTextColor(),
- m_labelBackground,
+ m_theme->isLabelBackgroundEnabled(),
m_theme->isLabelBorderEnabled(),
widestLabel);
@@ -382,4 +378,4 @@ void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestL
}
}
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
diff --git a/src/datavisualization/engine/drawer_p.h b/src/datavisualization/engine/drawer_p.h
index 8bc62209..35a0a7ff 100644
--- a/src/datavisualization/engine/drawer_p.h
+++ b/src/datavisualization/engine/drawer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -36,7 +36,7 @@
#include "abstractrenderitem_p.h"
#include <QFont>
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class ShaderHelper;
class ObjectHelper;
@@ -70,9 +70,7 @@ public:
void setTheme(Q3DTheme *theme);
Q3DTheme *theme() const;
- void setFont(const QFont &font);
QFont font() const;
- void setLabelBackground(bool enabled);
void drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId = 0,
GLuint depthTextureId = 0);
@@ -81,7 +79,7 @@ public:
void drawLabel(const AbstractRenderItem &item, const LabelItem &labelItem,
const QMatrix4x4 &viewmatrix, const QMatrix4x4 &projectionmatrix,
const QVector3D &positionComp, const QVector3D &rotation, GLfloat itemHeight,
- QDataVis::SelectionFlags mode, ShaderHelper *shader, ObjectHelper *object,
+ QAbstract3DGraph::SelectionFlags mode, ShaderHelper *shader, ObjectHelper *object,
const Q3DCamera *camera, bool useDepth = false, bool rotateAlong = false,
LabelPosition position = LabelOver,
Qt::AlignmentFlag alignment = Qt::AlignCenter, bool isSlicing = false);
@@ -94,12 +92,10 @@ Q_SIGNALS:
private:
Q3DTheme *m_theme;
- QFont m_font;
- bool m_labelBackground;
TextureHelper *m_textureHelper;
GLuint m_pointbuffer;
};
-QT_DATAVISUALIZATION_END_NAMESPACE
+QT_END_NAMESPACE_DATAVISUALIZATION
#endif
diff --git a/src/datavisualization/engine/engine.pri b/src/datavisualization/engine/engine.pri
index 899979e1..e13a9a04 100644
--- a/src/datavisualization/engine/engine.pri
+++ b/src/datavisualization/engine/engine.pri
@@ -1,5 +1,5 @@
-HEADERS += $$PWD/q3dwindow_p.h \
- $$PWD/q3dwindow.h \
+HEADERS += $$PWD/qabstract3dgraph_p.h \
+ $$PWD/qabstract3dgraph.h \
$$PWD/q3dbars.h \
$$PWD/q3dbars_p.h \
$$PWD/drawer_p.h \
@@ -28,7 +28,7 @@ HEADERS += $$PWD/q3dwindow_p.h \
$$PWD/q3dobject_p.h \
$$PWD/q3dscene_p.h
-SOURCES += $$PWD/q3dwindow.cpp \
+SOURCES += $$PWD/qabstract3dgraph.cpp \
$$PWD/q3dbars.cpp \
$$PWD/drawer.cpp \
$$PWD/bars3dcontroller.cpp \
diff --git a/src/datavisualization/engine/engine.qrc b/src/datavisualization/engine/engine.qrc
index 8fcaecec..18cba7fe 100644
--- a/src/datavisualization/engine/engine.qrc
+++ b/src/datavisualization/engine/engine.qrc
@@ -27,6 +27,8 @@
<file alias="negativeBackground">meshes/backgroundNegatives.obj</file>
<file alias="minimal">meshes/minimalFlat.obj</file>
<file alias="minimalSmooth">meshes/minimalSmooth.obj</file>
+ <file alias="arrow">meshes/arrowFlat.obj</file>
+ <file alias="arrowSmooth">meshes/arrowSmooth.obj</file>
</qresource>
<qresource prefix="/shaders">
<file alias="fragment">shaders/default.frag</file>
diff --git a/src/datavisualization/engine/meshes/arrowFlat.obj b/src/datavisualization/engine/meshes/arrowFlat.obj
new file mode 100644
index 00000000..bb9762d6
--- /dev/null
+++ b/src/datavisualization/engine/meshes/arrowFlat.obj
@@ -0,0 +1,403 @@
+# Blender v2.69 (sub 0) OBJ File: 'arrow.blend'
+# www.blender.org
+v 0.000000 1.000000 0.000000
+v 0.000000 0.000000 -1.000000
+v -0.195090 0.000000 -0.980785
+v -0.382683 0.000000 -0.923880
+v -0.555570 0.000000 -0.831470
+v -0.707107 0.000000 -0.707107
+v -0.831470 0.000000 -0.555570
+v -0.923880 0.000000 -0.382683
+v -0.980785 0.000000 -0.195090
+v -1.000000 0.000000 -0.000000
+v -0.980785 0.000000 0.195090
+v -0.923880 0.000000 0.382683
+v -0.831470 0.000000 0.555570
+v -0.707107 0.000000 0.707107
+v -0.555570 0.000000 0.831470
+v -0.382683 0.000000 0.923880
+v -0.195090 0.000000 0.980785
+v 0.000000 0.000000 1.000000
+v 0.195091 0.000000 0.980785
+v 0.382684 0.000000 0.923879
+v 0.555571 0.000000 0.831469
+v 0.707107 0.000000 0.707106
+v 0.831470 0.000000 0.555570
+v 0.923880 0.000000 0.382683
+v 0.980785 0.000000 0.195089
+v 1.000000 0.000000 -0.000001
+v 0.980785 0.000000 -0.195091
+v 0.923879 0.000000 -0.382684
+v 0.831469 0.000000 -0.555571
+v 0.707106 0.000000 -0.707108
+v 0.555569 0.000000 -0.831470
+v 0.382682 0.000000 -0.923880
+v 0.195089 0.000000 -0.980786
+v 0.000000 0.000000 0.000000
+v 0.000000 0.000000 0.000000
+v -0.000000 0.000000 -0.578860
+v -0.112930 0.000000 -0.567737
+v -0.221520 0.000000 -0.534796
+v -0.321597 0.000000 -0.481304
+v -0.409315 0.000000 -0.409316
+v -0.481304 0.000000 -0.321597
+v -0.534796 0.000000 -0.221520
+v -0.567737 0.000000 -0.112930
+v -0.578859 0.000000 -0.000000
+v -0.567737 0.000000 0.112930
+v -0.534796 0.000000 0.221520
+v -0.481304 0.000000 0.321597
+v -0.409315 0.000000 0.409315
+v -0.321597 0.000000 0.481304
+v -0.221520 0.000000 0.534796
+v -0.112930 0.000000 0.567737
+v 0.000000 0.000000 0.578859
+v 0.112930 0.000000 0.567737
+v 0.221520 0.000000 0.534796
+v 0.321597 0.000000 0.481304
+v 0.409316 0.000000 0.409315
+v 0.481304 0.000000 0.321597
+v 0.534796 0.000000 0.221519
+v 0.567737 0.000000 0.112929
+v 0.578859 0.000000 -0.000001
+v 0.567737 0.000000 -0.112931
+v 0.534796 0.000000 -0.221521
+v 0.481304 0.000000 -0.321598
+v 0.409315 0.000000 -0.409316
+v 0.321596 0.000000 -0.481305
+v 0.221519 0.000000 -0.534797
+v 0.112929 0.000000 -0.567737
+v 0.578859 -1.000000 -0.000001
+v 0.567737 -1.000000 0.112929
+v -0.221520 -1.000000 -0.534796
+v -0.112930 -1.000000 -0.567737
+v -0.321597 -1.000000 0.481304
+v -0.409315 -1.000000 0.409315
+v 0.534796 -1.000000 0.221519
+v 0.481304 -1.000000 0.321597
+v -0.481304 -1.000000 0.321597
+v -0.534796 -1.000000 0.221520
+v 0.112929 -1.000000 -0.567737
+v 0.221519 -1.000000 -0.534797
+v 0.409316 -1.000000 0.409315
+v 0.321597 -1.000000 0.481304
+v -0.567737 -1.000000 0.112930
+v -0.578859 -1.000000 -0.000000
+v 0.321596 -1.000000 -0.481305
+v 0.409315 -1.000000 -0.409316
+v 0.221520 -1.000000 0.534796
+v 0.112930 -1.000000 0.567737
+v -0.567737 -1.000000 -0.112930
+v -0.534796 -1.000000 -0.221520
+v 0.481304 -1.000000 -0.321598
+v 0.534796 -1.000000 -0.221521
+v -0.481304 -1.000000 -0.321597
+v -0.409315 -1.000000 -0.409316
+v 0.000000 -1.000000 0.578859
+v -0.112930 -1.000000 0.567737
+v 0.567737 -1.000000 -0.112931
+v -0.321597 -1.000000 -0.481304
+v -0.221520 -1.000000 0.534796
+v -0.000000 -1.000000 -0.578860
+vt 0.000000 0.000000
+vt 0.549236 0.999900
+vt 0.450764 0.999900
+vt 0.645815 0.980689
+vt 0.354184 0.980689
+vt 0.263208 0.943005
+vt 0.181332 0.888297
+vt 0.111702 0.818667
+vt 0.056994 0.736790
+vt 0.019311 0.645815
+vt 0.000100 0.549235
+vt 0.000100 0.450763
+vt 0.019310 0.354184
+vt 0.056994 0.263208
+vt 0.111702 0.181332
+vt 0.943005 0.263208
+vt 0.818666 0.111702
+vt 0.888296 0.181332
+vt 0.980688 0.354184
+vt 0.999899 0.549236
+vt 0.999899 0.450764
+vt 0.943005 0.736791
+vt 0.980689 0.645815
+vt 0.181332 0.111702
+vt 0.736791 0.943006
+vt 0.263209 0.056994
+vt 0.354185 0.019311
+vt 0.450764 0.000100
+vt 0.818667 0.888298
+vt 0.888297 0.818668
+vt 0.549235 0.000100
+vt 0.645815 0.019311
+vt 0.736791 0.056994
+vn -0.069476 0.705398 -0.705398
+vn -0.205757 0.705398 -0.678290
+vn -0.334131 0.705398 -0.625116
+vn -0.449665 0.705398 -0.547918
+vn -0.547918 0.705398 -0.449665
+vn -0.625116 0.705398 -0.334131
+vn -0.678290 0.705398 -0.205757
+vn -0.705398 0.705398 -0.069476
+vn -0.705398 0.705398 0.069476
+vn -0.678290 0.705398 0.205757
+vn -0.625116 0.705398 0.334131
+vn -0.547918 0.705398 0.449665
+vn -0.449665 0.705398 0.547918
+vn -0.334131 0.705398 0.625116
+vn -0.205757 0.705398 0.678290
+vn -0.069476 0.705398 0.705398
+vn 0.069476 0.705398 0.705398
+vn 0.205757 0.705398 0.678290
+vn 0.334132 0.705398 0.625116
+vn 0.449665 0.705398 0.547918
+vn 0.547919 0.705398 0.449665
+vn 0.625116 0.705398 0.334131
+vn 0.678290 0.705398 0.205756
+vn 0.705398 0.705398 0.069475
+vn 0.705398 0.705398 -0.069476
+vn 0.678290 0.705398 -0.205758
+vn 0.625115 0.705398 -0.334132
+vn 0.547918 0.705398 -0.449666
+vn 0.449664 0.705398 -0.547919
+vn 0.334130 0.705398 -0.625116
+vn 0.205756 0.705398 -0.678290
+vn 0.069475 0.705398 -0.705398
+vn 0.000000 -1.000000 0.000000
+vn -0.290284 0.000000 0.956940
+vn -0.098016 0.000000 0.995185
+vn -0.634393 0.000000 -0.773010
+vn -0.773011 0.000000 -0.634393
+vn 0.956940 0.000000 -0.290286
+vn 0.881921 0.000000 -0.471398
+vn -0.881922 0.000000 -0.471396
+vn -0.956940 0.000000 -0.290285
+vn 0.098017 0.000000 0.995185
+vn 0.290284 0.000000 0.956940
+vn 0.773010 0.000000 -0.634394
+vn 0.634392 0.000000 -0.773011
+vn -0.995185 0.000000 -0.098017
+vn -0.995185 0.000000 0.098017
+vn 0.471397 0.000000 0.881921
+vn 0.634394 0.000000 0.773010
+vn 0.471395 0.000000 -0.881922
+vn 0.290283 0.000000 -0.956941
+vn 0.098017 0.000000 -0.995185
+vn -0.956940 0.000000 0.290285
+vn -0.881921 0.000000 0.471396
+vn 0.773011 0.000000 0.634393
+vn 0.881922 0.000000 0.471396
+vn -0.773010 0.000000 0.634393
+vn -0.634393 0.000000 0.773010
+vn -0.471397 0.000000 0.881921
+vn -0.098018 0.000000 -0.995185
+vn -0.290284 0.000000 -0.956940
+vn -0.471397 0.000000 -0.881921
+vn 0.956941 0.000000 0.290284
+vn 0.995185 0.000000 0.098016
+vn 0.995185 0.000000 -0.098018
+vn 0.000000 -1.000000 -0.000004
+vn 0.000000 -1.000000 -0.000001
+vn 0.000000 -1.000000 0.000001
+vn -0.098017 0.000000 0.995185
+vn -0.773010 0.000000 -0.634393
+vn -0.881921 0.000000 -0.471396
+vn 0.098018 0.000000 0.995185
+vn 0.290285 0.000000 0.956940
+vn 0.773009 0.000000 -0.634394
+vn 0.471396 0.000000 -0.881922
+vn -0.881921 0.000000 0.471397
+vn -0.098017 0.000000 -0.995185
+vn -0.471396 0.000000 -0.881921
+s off
+f 1/1/1 2/1/1 3/1/1
+f 1/1/2 3/1/2 4/1/2
+f 1/1/3 4/1/3 5/1/3
+f 1/1/4 5/1/4 6/1/4
+f 1/1/5 6/1/5 7/1/5
+f 1/1/6 7/1/6 8/1/6
+f 1/1/7 8/1/7 9/1/7
+f 1/1/8 9/1/8 10/1/8
+f 1/1/9 10/1/9 11/1/9
+f 1/1/10 11/1/10 12/1/10
+f 1/1/11 12/1/11 13/1/11
+f 1/1/12 13/1/12 14/1/12
+f 1/1/13 14/1/13 15/1/13
+f 1/1/14 15/1/14 16/1/14
+f 1/1/15 16/1/15 17/1/15
+f 1/1/16 17/1/16 18/1/16
+f 1/1/17 18/1/17 19/1/17
+f 1/1/18 19/1/18 20/1/18
+f 1/1/19 20/1/19 21/1/19
+f 1/1/20 21/1/20 22/1/20
+f 1/1/21 22/1/21 23/1/21
+f 1/1/22 23/1/22 24/1/22
+f 1/1/23 24/1/23 25/1/23
+f 1/1/24 25/1/24 26/1/24
+f 1/1/25 26/1/25 27/1/25
+f 1/1/26 27/1/26 28/1/26
+f 1/1/27 28/1/27 29/1/27
+f 1/1/28 29/1/28 30/1/28
+f 1/1/29 30/1/29 31/1/29
+f 1/1/30 31/1/30 32/1/30
+f 1/1/31 32/1/31 33/1/31
+f 1/1/32 33/1/32 2/1/32
+f 24/1/33 23/1/33 58/1/33
+f 13/1/33 12/1/33 47/1/33
+f 2/1/33 33/1/33 36/1/33
+f 23/1/33 22/1/33 57/1/33
+f 12/1/33 11/1/33 46/1/33
+f 33/1/33 32/1/33 67/1/33
+f 22/1/33 21/1/33 56/1/33
+f 11/1/33 10/1/33 45/1/33
+f 32/1/33 31/1/33 66/1/33
+f 21/1/33 20/1/33 55/1/33
+f 10/1/33 9/1/33 44/1/33
+f 31/1/33 30/1/33 65/1/33
+f 20/1/33 19/1/33 54/1/33
+f 9/1/33 8/1/33 43/1/33
+f 30/1/33 29/1/33 64/1/33
+f 19/1/33 18/1/33 53/1/33
+f 3/1/33 2/1/33 37/1/33
+f 8/1/33 7/1/33 42/1/33
+f 29/1/33 28/1/33 63/1/33
+f 7/1/33 6/1/33 41/1/33
+f 18/1/33 17/1/33 52/1/33
+f 28/1/33 27/1/33 62/1/33
+f 6/1/33 5/1/33 40/1/33
+f 17/1/33 16/1/33 51/1/33
+f 27/1/33 26/1/33 61/1/33
+f 5/1/33 4/1/33 39/1/33
+f 16/1/33 15/1/33 50/1/33
+f 26/1/33 25/1/33 60/1/33
+f 4/1/33 3/1/33 38/1/33
+f 15/1/33 14/1/33 49/1/33
+f 25/1/33 24/1/33 59/1/33
+f 14/1/33 13/1/33 48/1/33
+f 81/2/33 86/3/33 80/4/33
+f 51/1/34 50/1/34 95/1/34
+f 52/1/35 51/1/35 94/1/35
+f 40/1/36 39/1/36 93/1/36
+f 41/1/37 40/1/37 92/1/37
+f 62/1/38 61/1/38 91/1/38
+f 63/1/39 62/1/39 90/1/39
+f 42/1/40 41/1/40 89/1/40
+f 43/1/41 42/1/41 88/1/41
+f 53/1/42 52/1/42 87/1/42
+f 54/1/43 53/1/43 86/1/43
+f 64/1/44 63/1/44 85/1/44
+f 65/1/45 64/1/45 84/1/45
+f 44/1/46 43/1/46 83/1/46
+f 45/1/47 44/1/47 82/1/47
+f 55/1/48 54/1/48 81/1/48
+f 56/1/49 55/1/49 80/1/49
+f 66/1/50 65/1/50 79/1/50
+f 67/1/51 66/1/51 78/1/51
+f 36/1/52 67/1/52 99/1/52
+f 46/1/53 45/1/53 77/1/53
+f 47/1/54 46/1/54 76/1/54
+f 57/1/55 56/1/55 75/1/55
+f 58/1/56 57/1/56 74/1/56
+f 48/1/57 47/1/57 73/1/57
+f 49/1/58 48/1/58 72/1/58
+f 50/1/59 49/1/59 98/1/59
+f 37/1/60 36/1/60 71/1/60
+f 38/1/61 37/1/61 70/1/61
+f 39/1/62 38/1/62 97/1/62
+f 59/1/63 58/1/63 69/1/63
+f 60/1/64 59/1/64 68/1/64
+f 61/1/65 60/1/65 96/1/65
+f 23/1/33 57/1/33 58/1/33
+f 12/1/33 46/1/33 47/1/33
+f 33/1/33 67/1/33 36/1/33
+f 22/1/33 56/1/33 57/1/33
+f 11/1/33 45/1/33 46/1/33
+f 32/1/33 66/1/33 67/1/33
+f 21/1/33 55/1/33 56/1/33
+f 10/1/33 44/1/33 45/1/33
+f 31/1/33 65/1/33 66/1/33
+f 20/1/33 54/1/33 55/1/33
+f 9/1/33 43/1/33 44/1/33
+f 30/1/33 64/1/33 65/1/33
+f 19/1/33 53/1/33 54/1/33
+f 8/1/33 42/1/33 43/1/33
+f 29/1/33 63/1/33 64/1/33
+f 18/1/33 52/1/33 53/1/33
+f 2/1/33 36/1/33 37/1/33
+f 7/1/33 41/1/33 42/1/33
+f 28/1/33 62/1/33 63/1/33
+f 6/1/33 40/1/33 41/1/33
+f 17/1/33 51/1/33 52/1/33
+f 27/1/33 61/1/33 62/1/33
+f 5/1/33 39/1/33 40/1/33
+f 16/1/33 50/1/33 51/1/33
+f 26/1/33 60/1/33 61/1/33
+f 4/1/33 38/1/33 39/1/33
+f 15/1/33 49/1/33 50/1/33
+f 25/1/33 59/1/33 60/1/33
+f 3/1/33 37/1/33 38/1/33
+f 14/1/33 48/1/33 49/1/33
+f 24/1/33 58/1/33 59/1/33
+f 13/1/33 47/1/33 48/1/33
+f 86/3/33 87/5/33 80/4/33
+f 87/5/66 94/6/66 80/4/66
+f 94/6/33 95/7/33 80/4/33
+f 95/7/33 98/8/33 80/4/33
+f 98/8/33 72/9/33 80/4/33
+f 72/9/33 73/10/33 80/4/33
+f 73/10/33 76/11/33 80/4/33
+f 76/11/33 77/12/33 80/4/33
+f 77/12/67 82/13/67 80/4/67
+f 82/13/33 83/14/33 80/4/33
+f 83/14/68 88/15/68 80/4/68
+f 84/16/33 78/17/33 79/18/33
+f 85/19/66 78/17/66 84/16/66
+f 91/20/33 85/19/33 90/21/33
+f 91/20/33 78/17/33 85/19/33
+f 68/22/33 91/20/33 96/23/33
+f 68/22/33 78/17/33 91/20/33
+f 88/15/67 89/24/67 80/4/67
+f 80/4/33 89/24/33 75/25/33
+f 89/24/33 92/26/33 75/25/33
+f 92/26/68 93/27/68 75/25/68
+f 93/27/33 97/28/33 75/25/33
+f 75/25/33 97/28/33 74/29/33
+f 69/30/33 78/17/33 68/22/33
+f 74/29/33 97/28/33 69/30/33
+f 97/28/33 70/31/33 69/30/33
+f 70/31/68 71/32/68 69/30/68
+f 71/32/33 99/33/33 69/30/33
+f 99/33/33 78/17/33 69/30/33
+f 50/1/34 98/1/34 95/1/34
+f 51/1/69 95/1/69 94/1/69
+f 39/1/36 97/1/36 93/1/36
+f 40/1/70 93/1/70 92/1/70
+f 61/1/38 96/1/38 91/1/38
+f 62/1/39 91/1/39 90/1/39
+f 41/1/71 92/1/71 89/1/71
+f 42/1/41 89/1/41 88/1/41
+f 52/1/72 94/1/72 87/1/72
+f 53/1/73 87/1/73 86/1/73
+f 63/1/74 90/1/74 85/1/74
+f 64/1/45 85/1/45 84/1/45
+f 43/1/46 88/1/46 83/1/46
+f 44/1/47 83/1/47 82/1/47
+f 54/1/48 86/1/48 81/1/48
+f 55/1/49 81/1/49 80/1/49
+f 65/1/75 84/1/75 79/1/75
+f 66/1/51 79/1/51 78/1/51
+f 67/1/52 78/1/52 99/1/52
+f 45/1/53 82/1/53 77/1/53
+f 46/1/76 77/1/76 76/1/76
+f 56/1/55 80/1/55 75/1/55
+f 57/1/56 75/1/56 74/1/56
+f 47/1/57 76/1/57 73/1/57
+f 48/1/58 73/1/58 72/1/58
+f 49/1/59 72/1/59 98/1/59
+f 36/1/77 99/1/77 71/1/77
+f 37/1/61 71/1/61 70/1/61
+f 38/1/78 70/1/78 97/1/78
+f 58/1/63 74/1/63 69/1/63
+f 59/1/64 69/1/64 68/1/64
+f 60/1/65 68/1/65 96/1/65
diff --git a/src/datavisualization/engine/meshes/arrowSmooth.obj b/src/datavisualization/engine/meshes/arrowSmooth.obj
new file mode 100644
index 00000000..898c4a2b
--- /dev/null
+++ b/src/datavisualization/engine/meshes/arrowSmooth.obj
@@ -0,0 +1,422 @@
+# Blender v2.69 (sub 0) OBJ File: 'arrow.blend'
+# www.blender.org
+v 0.000000 1.000000 0.000000
+v 0.000000 0.000000 -1.000000
+v -0.195090 0.000000 -0.980785
+v -0.382683 0.000000 -0.923880
+v -0.555570 0.000000 -0.831470
+v -0.707107 0.000000 -0.707107
+v -0.831470 0.000000 -0.555570
+v -0.923880 0.000000 -0.382683
+v -0.980785 0.000000 -0.195090
+v -1.000000 0.000000 -0.000000
+v -0.980785 0.000000 0.195090
+v -0.923880 0.000000 0.382683
+v -0.831470 0.000000 0.555570
+v -0.707107 0.000000 0.707107
+v -0.555570 0.000000 0.831470
+v -0.382683 0.000000 0.923880
+v -0.195090 0.000000 0.980785
+v 0.000000 0.000000 1.000000
+v 0.195091 0.000000 0.980785
+v 0.382684 0.000000 0.923879
+v 0.555571 0.000000 0.831469
+v 0.707107 0.000000 0.707106
+v 0.831470 0.000000 0.555570
+v 0.923880 0.000000 0.382683
+v 0.980785 0.000000 0.195089
+v 1.000000 0.000000 -0.000001
+v 0.980785 0.000000 -0.195091
+v 0.923879 0.000000 -0.382684
+v 0.831469 0.000000 -0.555571
+v 0.707106 0.000000 -0.707108
+v 0.555569 0.000000 -0.831470
+v 0.382682 0.000000 -0.923880
+v 0.195089 0.000000 -0.980786
+v 0.000000 0.000000 0.000000
+v 0.000000 0.000000 0.000000
+v -0.000000 0.000000 -0.578860
+v -0.112930 0.000000 -0.567737
+v -0.221520 0.000000 -0.534796
+v -0.321597 0.000000 -0.481304
+v -0.409315 0.000000 -0.409316
+v -0.481304 0.000000 -0.321597
+v -0.534796 0.000000 -0.221520
+v -0.567737 0.000000 -0.112930
+v -0.578859 0.000000 -0.000000
+v -0.567737 0.000000 0.112930
+v -0.534796 0.000000 0.221520
+v -0.481304 0.000000 0.321597
+v -0.409315 0.000000 0.409315
+v -0.321597 0.000000 0.481304
+v -0.221520 0.000000 0.534796
+v -0.112930 0.000000 0.567737
+v 0.000000 0.000000 0.578859
+v 0.112930 0.000000 0.567737
+v 0.221520 0.000000 0.534796
+v 0.321597 0.000000 0.481304
+v 0.409316 0.000000 0.409315
+v 0.481304 0.000000 0.321597
+v 0.534796 0.000000 0.221519
+v 0.567737 0.000000 0.112929
+v 0.578859 0.000000 -0.000001
+v 0.567737 0.000000 -0.112931
+v 0.534796 0.000000 -0.221521
+v 0.481304 0.000000 -0.321598
+v 0.409315 0.000000 -0.409316
+v 0.321596 0.000000 -0.481305
+v 0.221519 0.000000 -0.534797
+v 0.112929 0.000000 -0.567737
+v 0.578859 -1.000000 -0.000001
+v 0.567737 -1.000000 0.112929
+v -0.221520 -1.000000 -0.534796
+v -0.112930 -1.000000 -0.567737
+v -0.321597 -1.000000 0.481304
+v -0.409315 -1.000000 0.409315
+v 0.534796 -1.000000 0.221519
+v 0.481304 -1.000000 0.321597
+v -0.481304 -1.000000 0.321597
+v -0.534796 -1.000000 0.221520
+v 0.112929 -1.000000 -0.567737
+v 0.221519 -1.000000 -0.534797
+v 0.409316 -1.000000 0.409315
+v 0.321597 -1.000000 0.481304
+v -0.567737 -1.000000 0.112930
+v -0.578859 -1.000000 -0.000000
+v 0.321596 -1.000000 -0.481305
+v 0.409315 -1.000000 -0.409316
+v 0.221520 -1.000000 0.534796
+v 0.112930 -1.000000 0.567737
+v -0.567737 -1.000000 -0.112930
+v -0.534796 -1.000000 -0.221520
+v 0.481304 -1.000000 -0.321598
+v 0.534796 -1.000000 -0.221521
+v -0.481304 -1.000000 -0.321597
+v -0.409315 -1.000000 -0.409316
+v 0.000000 -1.000000 0.578859
+v -0.112930 -1.000000 0.567737
+v 0.567737 -1.000000 -0.112931
+v -0.321597 -1.000000 -0.481304
+v -0.221520 -1.000000 0.534796
+v -0.000000 -1.000000 -0.578860
+vt 0.000000 0.000000
+vt 0.549236 0.999900
+vt 0.450764 0.999900
+vt 0.645815 0.980689
+vt 0.354184 0.980689
+vt 0.263208 0.943005
+vt 0.181332 0.888297
+vt 0.111702 0.818667
+vt 0.056994 0.736790
+vt 0.019311 0.645815
+vt 0.000100 0.549235
+vt 0.000100 0.450763
+vt 0.019310 0.354184
+vt 0.056994 0.263208
+vt 0.111702 0.181332
+vt 0.943005 0.263208
+vt 0.818666 0.111702
+vt 0.888296 0.181332
+vt 0.980688 0.354184
+vt 0.999899 0.549236
+vt 0.999899 0.450764
+vt 0.943005 0.736791
+vt 0.980689 0.645815
+vt 0.181332 0.111702
+vt 0.736791 0.943006
+vt 0.263209 0.056994
+vt 0.354185 0.019311
+vt 0.450764 0.000100
+vt 0.818667 0.888298
+vt 0.888297 0.818668
+vt 0.549235 0.000100
+vt 0.645815 0.019311
+vt 0.736791 0.056994
+vn 0.000000 1.000000 0.000000
+vn 0.000000 -0.363689 -0.931516
+vn -0.181707 -0.363689 -0.913602
+vn -0.356456 -0.363689 -0.860591
+vn -0.517502 -0.363689 -0.774499
+vn -0.658681 -0.363689 -0.658681
+vn -0.774499 -0.363689 -0.517502
+vn -0.860591 -0.363689 -0.356456
+vn -0.913602 -0.363689 -0.181707
+vn -0.931516 -0.363689 0.000000
+vn -0.913602 -0.363689 0.181707
+vn -0.860591 -0.363689 0.356456
+vn -0.774499 -0.363689 0.517502
+vn -0.658681 -0.363689 0.658681
+vn -0.517502 -0.363689 0.774499
+vn -0.356456 -0.363689 0.860591
+vn -0.181707 -0.363689 0.913602
+vn 0.000000 -0.363689 0.931516
+vn 0.181707 -0.363689 0.913602
+vn 0.356456 -0.363689 0.860591
+vn 0.517502 -0.363689 0.774499
+vn 0.658681 -0.363689 0.658681
+vn 0.774499 -0.363689 0.517502
+vn 0.860591 -0.363689 0.356456
+vn 0.913602 -0.363689 0.181707
+vn 0.931516 -0.363689 0.000000
+vn 0.913602 -0.363689 -0.181707
+vn 0.860591 -0.363689 -0.356456
+vn 0.774499 -0.363689 -0.517502
+vn 0.658681 -0.363689 -0.658681
+vn 0.517502 -0.363689 -0.774499
+vn 0.356456 -0.363689 -0.860591
+vn 0.181707 -0.363689 -0.913602
+vn 0.631550 -0.729820 0.261605
+vn -0.568377 -0.729820 0.379772
+vn 0.000000 -0.729820 -0.683584
+vn 0.568377 -0.729820 0.379772
+vn -0.631550 -0.729820 0.261605
+vn 0.133335 -0.729820 -0.670461
+vn 0.483383 -0.729820 0.483383
+vn -0.670461 -0.729820 0.133335
+vn 0.261574 -0.729820 -0.631550
+vn 0.379772 -0.729820 0.568377
+vn -0.683584 -0.729820 0.000000
+vn 0.379772 -0.729820 -0.568377
+vn 0.261605 -0.729820 0.631550
+vn -0.670461 -0.729820 -0.133335
+vn 0.483383 -0.729820 -0.483383
+vn 0.133335 -0.729820 0.670461
+vn -0.133335 -0.729820 -0.670461
+vn -0.631550 -0.729820 -0.261605
+vn 0.568377 -0.729820 -0.379772
+vn -0.568377 -0.729820 -0.379772
+vn 0.000000 -0.729820 0.683584
+vn 0.631550 -0.729820 -0.261605
+vn -0.483383 -0.729820 -0.483383
+vn -0.133335 -0.729820 0.670461
+vn 0.670461 -0.729820 -0.133366
+vn -0.379772 -0.729820 -0.568377
+vn -0.261605 -0.729820 0.631550
+vn 0.683584 -0.729820 0.000000
+vn -0.261605 -0.729820 -0.631550
+vn -0.379772 -0.729820 0.568377
+vn 0.670461 -0.729820 0.133335
+vn -0.483383 -0.729820 0.483383
+vn 0.404370 -0.685690 0.605213
+vn 0.278542 -0.685690 0.672475
+vn 0.514695 -0.685690 0.514664
+vn -0.142003 -0.685690 0.713889
+vn 0.000000 -0.685690 0.727866
+vn -0.514664 -0.685690 -0.514664
+vn -0.605213 -0.685690 -0.404370
+vn 0.672475 -0.685690 -0.278542
+vn 0.605213 -0.685690 -0.404370
+vn -0.672475 -0.685690 -0.278542
+vn -0.713889 -0.685690 -0.142003
+vn 0.142003 -0.685690 0.713889
+vn 0.514664 -0.685690 -0.514695
+vn 0.404370 -0.685690 -0.605213
+vn -0.727866 -0.685690 0.000000
+vn -0.713889 -0.685690 0.142003
+vn 0.278542 -0.685690 -0.672475
+vn 0.142003 -0.685690 -0.713889
+vn 0.000000 -0.685690 -0.727866
+vn -0.672475 -0.685690 0.278542
+vn -0.605213 -0.685690 0.404370
+vn 0.605213 -0.685690 0.404370
+vn 0.672475 -0.685690 0.278542
+vn -0.514664 -0.685690 0.514664
+vn -0.404370 -0.685690 0.605213
+vn -0.278542 -0.685690 0.672475
+vn -0.142003 -0.685690 -0.713889
+vn -0.278542 -0.685690 -0.672475
+vn -0.404370 -0.685690 -0.605213
+vn 0.713889 -0.685690 0.142003
+vn 0.727866 -0.685690 0.000000
+vn 0.713889 -0.685690 -0.142003
+s 1
+f 1/1/1 2/1/2 3/1/3
+f 1/1/1 3/1/3 4/1/4
+f 1/1/1 4/1/4 5/1/5
+f 1/1/1 5/1/5 6/1/6
+f 1/1/1 6/1/6 7/1/7
+f 1/1/1 7/1/7 8/1/8
+f 1/1/1 8/1/8 9/1/9
+f 1/1/1 9/1/9 10/1/10
+f 1/1/1 10/1/10 11/1/11
+f 1/1/1 11/1/11 12/1/12
+f 1/1/1 12/1/12 13/1/13
+f 1/1/1 13/1/13 14/1/14
+f 1/1/1 14/1/14 15/1/15
+f 1/1/1 15/1/15 16/1/16
+f 1/1/1 16/1/16 17/1/17
+f 1/1/1 17/1/17 18/1/18
+f 1/1/1 18/1/18 19/1/19
+f 1/1/1 19/1/19 20/1/20
+f 1/1/1 20/1/20 21/1/21
+f 1/1/1 21/1/21 22/1/22
+f 1/1/1 22/1/22 23/1/23
+f 1/1/1 23/1/23 24/1/24
+f 1/1/1 24/1/24 25/1/25
+f 1/1/1 25/1/25 26/1/26
+f 1/1/1 26/1/26 27/1/27
+f 1/1/1 27/1/27 28/1/28
+f 1/1/1 28/1/28 29/1/29
+f 1/1/1 29/1/29 30/1/30
+f 1/1/1 30/1/30 31/1/31
+f 1/1/1 31/1/31 32/1/32
+f 1/1/1 32/1/32 33/1/33
+f 1/1/1 33/1/33 2/1/2
+f 24/1/24 23/1/23 58/1/34
+f 13/1/13 12/1/12 47/1/35
+f 2/1/2 33/1/33 36/1/36
+f 23/1/23 22/1/22 57/1/37
+f 12/1/12 11/1/11 46/1/38
+f 33/1/33 32/1/32 67/1/39
+f 22/1/22 21/1/21 56/1/40
+f 11/1/11 10/1/10 45/1/41
+f 32/1/32 31/1/31 66/1/42
+f 21/1/21 20/1/20 55/1/43
+f 10/1/10 9/1/9 44/1/44
+f 31/1/31 30/1/30 65/1/45
+f 20/1/20 19/1/19 54/1/46
+f 9/1/9 8/1/8 43/1/47
+f 30/1/30 29/1/29 64/1/48
+f 19/1/19 18/1/18 53/1/49
+f 3/1/3 2/1/2 37/1/50
+f 8/1/8 7/1/7 42/1/51
+f 29/1/29 28/1/28 63/1/52
+f 7/1/7 6/1/6 41/1/53
+f 18/1/18 17/1/17 52/1/54
+f 28/1/28 27/1/27 62/1/55
+f 6/1/6 5/1/5 40/1/56
+f 17/1/17 16/1/16 51/1/57
+f 27/1/27 26/1/26 61/1/58
+f 5/1/5 4/1/4 39/1/59
+f 16/1/16 15/1/15 50/1/60
+f 26/1/26 25/1/25 60/1/61
+f 4/1/4 3/1/3 38/1/62
+f 15/1/15 14/1/14 49/1/63
+f 25/1/25 24/1/24 59/1/64
+f 14/1/14 13/1/13 48/1/65
+f 81/2/66 86/3/67 80/4/68
+f 51/1/57 50/1/60 95/1/69
+f 52/1/54 51/1/57 94/1/70
+f 40/1/56 39/1/59 93/1/71
+f 41/1/53 40/1/56 92/1/72
+f 62/1/55 61/1/58 91/1/73
+f 63/1/52 62/1/55 90/1/74
+f 42/1/51 41/1/53 89/1/75
+f 43/1/47 42/1/51 88/1/76
+f 53/1/49 52/1/54 87/1/77
+f 54/1/46 53/1/49 86/1/67
+f 64/1/48 63/1/52 85/1/78
+f 65/1/45 64/1/48 84/1/79
+f 44/1/44 43/1/47 83/1/80
+f 45/1/41 44/1/44 82/1/81
+f 55/1/43 54/1/46 81/1/66
+f 56/1/40 55/1/43 80/1/68
+f 66/1/42 65/1/45 79/1/82
+f 67/1/39 66/1/42 78/1/83
+f 36/1/36 67/1/39 99/1/84
+f 46/1/38 45/1/41 77/1/85
+f 47/1/35 46/1/38 76/1/86
+f 57/1/37 56/1/40 75/1/87
+f 58/1/34 57/1/37 74/1/88
+f 48/1/65 47/1/35 73/1/89
+f 49/1/63 48/1/65 72/1/90
+f 50/1/60 49/1/63 98/1/91
+f 37/1/50 36/1/36 71/1/92
+f 38/1/62 37/1/50 70/1/93
+f 39/1/59 38/1/62 97/1/94
+f 59/1/64 58/1/34 69/1/95
+f 60/1/61 59/1/64 68/1/96
+f 61/1/58 60/1/61 96/1/97
+f 23/1/23 57/1/37 58/1/34
+f 12/1/12 46/1/38 47/1/35
+f 33/1/33 67/1/39 36/1/36
+f 22/1/22 56/1/40 57/1/37
+f 11/1/11 45/1/41 46/1/38
+f 32/1/32 66/1/42 67/1/39
+f 21/1/21 55/1/43 56/1/40
+f 10/1/10 44/1/44 45/1/41
+f 31/1/31 65/1/45 66/1/42
+f 20/1/20 54/1/46 55/1/43
+f 9/1/9 43/1/47 44/1/44
+f 30/1/30 64/1/48 65/1/45
+f 19/1/19 53/1/49 54/1/46
+f 8/1/8 42/1/51 43/1/47
+f 29/1/29 63/1/52 64/1/48
+f 18/1/18 52/1/54 53/1/49
+f 2/1/2 36/1/36 37/1/50
+f 7/1/7 41/1/53 42/1/51
+f 28/1/28 62/1/55 63/1/52
+f 6/1/6 40/1/56 41/1/53
+f 17/1/17 51/1/57 52/1/54
+f 27/1/27 61/1/58 62/1/55
+f 5/1/5 39/1/59 40/1/56
+f 16/1/16 50/1/60 51/1/57
+f 26/1/26 60/1/61 61/1/58
+f 4/1/4 38/1/62 39/1/59
+f 15/1/15 49/1/63 50/1/60
+f 25/1/25 59/1/64 60/1/61
+f 3/1/3 37/1/50 38/1/62
+f 14/1/14 48/1/65 49/1/63
+f 24/1/24 58/1/34 59/1/64
+f 13/1/13 47/1/35 48/1/65
+f 86/3/67 87/5/77 80/4/68
+f 87/5/77 94/6/70 80/4/68
+f 94/6/70 95/7/69 80/4/68
+f 95/7/69 98/8/91 80/4/68
+f 98/8/91 72/9/90 80/4/68
+f 72/9/90 73/10/89 80/4/68
+f 73/10/89 76/11/86 80/4/68
+f 76/11/86 77/12/85 80/4/68
+f 77/12/85 82/13/81 80/4/68
+f 82/13/81 83/14/80 80/4/68
+f 83/14/80 88/15/76 80/4/68
+f 84/16/79 78/17/83 79/18/82
+f 85/19/78 78/17/83 84/16/79
+f 91/20/73 85/19/78 90/21/74
+f 91/20/73 78/17/83 85/19/78
+f 68/22/96 91/20/73 96/23/97
+f 68/22/96 78/17/83 91/20/73
+f 88/15/76 89/24/75 80/4/68
+f 80/4/68 89/24/75 75/25/87
+f 89/24/75 92/26/72 75/25/87
+f 92/26/72 93/27/71 75/25/87
+f 93/27/71 97/28/94 75/25/87
+f 75/25/87 97/28/94 74/29/88
+f 69/30/95 78/17/83 68/22/96
+f 74/29/88 97/28/94 69/30/95
+f 97/28/94 70/31/93 69/30/95
+f 70/31/93 71/32/92 69/30/95
+f 71/32/92 99/33/84 69/30/95
+f 99/33/84 78/17/83 69/30/95
+f 50/1/60 98/1/91 95/1/69
+f 51/1/57 95/1/69 94/1/70
+f 39/1/59 97/1/94 93/1/71
+f 40/1/56 93/1/71 92/1/72
+f 61/1/58 96/1/97 91/1/73
+f 62/1/55 91/1/73 90/1/74
+f 41/1/53 92/1/72 89/1/75
+f 42/1/51 89/1/75 88/1/76
+f 52/1/54 94/1/70 87/1/77
+f 53/1/49 87/1/77 86/1/67
+f 63/1/52 90/1/74 85/1/78
+f 64/1/48 85/1/78 84/1/79
+f 43/1/47 88/1/76 83/1/80
+f 44/1/44 83/1/80 82/1/81
+f 54/1/46 86/1/67 81/1/66
+f 55/1/43 81/1/66 80/1/68
+f 65/1/45 84/1/79 79/1/82
+f 66/1/42 79/1/82 78/1/83
+f 67/1/39 78/1/83 99/1/84
+f 45/1/41 82/1/81 77/1/85
+f 46/1/38 77/1/85 76/1/86
+f 56/1/40 80/1/68 75/1/87
+f 57/1/37 75/1/87 74/1/88
+f 47/1/35 76/1/86 73/1/89
+f 48/1/65 73/1/89 72/1/90
+f 49/1/63 72/1/90 98/1/91
+f 36/1/36 99/1/84 71/1/92
+f 37/1/50 71/1/92 70/1/93
+f 38/1/62 70/1/93 97/1/94
+f 58/1/34 74/1/88 69/1/95
+f 59/1/64 69/1/95 68/1/96
+f 60/1/61 68/1/96 96/1/97
diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp
index d4e97519..787033ad 100644
--- a/src/datavisualization/engine/q3dbars.cpp
+++ b/src/datavisualization/engine/q3dbars.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc
+** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
@@ -19,15 +19,12 @@
#include "q3dbars.h"
#include "q3dbars_p.h"
#include "bars3dcontroller_p.h"
-#include "q3dvalueaxis.h"
-#include "q3dcategoryaxis.h"
+#include "qvalue3daxis.h"
+#include "qcategory3daxis.h"
#include "q3dcamera.h"
#include "qbar3dseries_p.h"
-#include <QMouseEvent>
-
-
-QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \class Q3DBars
@@ -96,24 +93,17 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- * Constructs a new 3D bar graph with optional \a parent window.
+ * Constructs a new 3D bar graph with optional \a parent window
+ * and surface \a format.
*/
-Q3DBars::Q3DBars(QWindow *parent)
- : Q3DWindow(new Q3DBarsPrivate(this), parent)
+Q3DBars::Q3DBars(const QSurfaceFormat *format, QWindow *parent)
+ : QAbstract3DGraph(new Q3DBarsPrivate(this), format, parent)
{
dptr()->m_shared = new Bars3DController(geometry());
d_ptr->setVisualController(dptr()->m_shared);
dptr()->m_shared->initializeOpenGL();
- QObject::connect(dptr()->m_shared, &Abstract3DController::selectionModeChanged, this,
- &Q3DBars::selectionModeChanged);
- QObject::connect(dptr()->m_shared, &Abstract3DController::shadowQualityChanged, this,
- &Q3DBars::shadowQualityChanged);
- QObject::connect(dptr()->m_shared, &Abstract3DController::themeChanged, this,
- &Q3DBars::themeChanged);
- QObject::connect(dptr()->m_shared, &Abstract3DController::needRender, d_ptr.data(),
- &Q3DWindowPrivate::renderLater);
- QObject::connect(dptr()->m_shared, &Abstract3DController::shadowQualityChanged, dptr(),
- &Q3DBarsPrivate::handleShadowQualityUpdate);
+ QObject::connect(dptr()->m_shared, &Bars3DController::primarySeriesChanged,
+ this, &Q3DBars::primarySeriesChanged);
}
/*!
@@ -124,12 +114,37 @@ Q3DBars::~Q3DBars()
}
/*!
+ * \property Q3DBars::primarySeries
+ *
+ * Specifies the \a series that is the primary series of the graph. The primary series
+ * is used to determine the row and column axis labels when the labels are not explicitly
+ * set to the axes.
+ * If the specified \a series is not already added to the graph, setting it as the
+ * primary series will also implicitly add it to the graph.
+ * If the primary series itself is removed from the graph, this property
+ * resets to default.
+ * If \a series is null, this property resets to default.
+ * Defaults to the first added series or zero if no series are added to the graph.
+ */
+void Q3DBars::setPrimarySeries(QBar3DSeries *series)
+{
+ dptr()->m_shared->setPrimarySeries(series);
+}
+
+QBar3DSeries *Q3DBars::primarySeries() const
+{
+ return dptrc()->m_shared->primarySeries();
+}
+
+/*!
* Adds the \a series to the graph. A graph can contain multiple series, but only one set of axes,
* so the rows and columns of all series must match for the visualized data to be meaningful.
* If the graph has multiple visible series, only the first one added will
* generate the row or column labels on the axes in cases where the labels are not explicitly set
* to the axes. If the newly added series has specified a selected bar, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
+ *
+ * /sa seriesList()
*/
void Q3DBars::addSeries(QBar3DSeries *series)
{
@@ -145,70 +160,46 @@ void Q3DBars::removeSeries(QBar3DSeries *series)
}
/*!
- * \return list of series added to this graph.
- */
-QList<QBar3DSeries *> Q3DBars::seriesList()
-{
- return dptr()->m_shared->barSeriesList();
-}
-
-/*!
- * \internal
- */
-void Q3DBars::mouseDoubleClickEvent(QMouseEvent *event)
-{
- dptr()->m_shared->mouseDoubleClickEvent(event);
-}
-
-/*!
- * \internal
- */
-void Q3DBars::touchEvent(QTouchEvent *event)
-{
- dptr()->m_shared->touchEvent(event);
-}
-
-/*!
- * \internal
- */
-void Q3DBars::mousePressEvent(QMouseEvent *event)
-{
- dptr()->m_shared->mousePressEvent(event, event->pos());
-}
-
-/*!
- * \internal
+ * Inserts the \a series into the position \a index in the series list.
+ * If the \a series has already been added to the list, it is moved to the
+ * new \a index.
+ * \note When moving a series to a new \a index that is after its old index,
+ * the new position in list is calculated as if the series was still in its old
+ * index, so the final index is actually the \a index decremented by one.
+ *
+ * \sa addSeries(), seriesList()
*/
-void Q3DBars::mouseReleaseEvent(QMouseEvent *event)
+void Q3DBars::insertSeries(int index, QBar3DSeries *series)
{
- dptr()->m_shared->mouseReleaseEvent(event, event->pos());
+ dptr()->m_shared->insertSeries(index, series);
}
/*!
- * \internal
+ * \return list of series added to this graph.
*/
-void Q3DBars::mouseMoveEvent(QMouseEvent *event)
+QList<QBar3DSeries *> Q3DBars::seriesList() const
{
- dptr()->m_shared->mouseMoveEvent(event, event->pos());
+ return dptrc()->m_shared->barSeriesList();
}
/*!
- * \internal
+ * \property Q3DBars::multiSeriesUniform
+ *
+ * This property controls if bars are to be scaled with proportions set to a single series bar even
+ * if there are multiple series displayed. If set to \c {true}, \l{barSpacing}{bar spacing} will
+ * affect only X-axis correctly. It is preset to \c false by default.
*/
-void Q3DBars::wheelEvent(QWheelEvent *event)
+void Q3DBars::setMultiSeriesUniform(bool uniform)
{
- dptr()->m_shared->wheelEvent(event);
-}
-
-
-Q3DBarsPrivate *Q3DBars::dptr()
-{
- return static_cast<Q3DBarsPrivate *>(d_ptr.data());
+ if (uniform != isMultiSeriesUniform()) {
+ dptr()->m_shared->setMultiSeriesScaling(uniform);
+ emit multiSeriesUniformChanged(uniform);
+ }
}
-const Q3DBarsPrivate *Q3DBars::dptrc() const
+bool Q3DBars::isMultiSeriesUniform() const
{
- return static_cast<const Q3DBarsPrivate *>(d_ptr.data());
+ return dptrc()->m_shared->multiSeriesScaling();
}
/*!
@@ -220,14 +211,15 @@ const Q3DBarsPrivate *Q3DBars::dptrc() const
void Q3DBars::setBarThickness(float thicknessRatio)
{
if (thicknessRatio != barThickness()) {
- dptr()->m_shared->setBarSpecs(GLfloat(thicknessRatio), barSpacing(), isBarSpacingRelative());
+ dptr()->m_shared->setBarSpecs(GLfloat(thicknessRatio), barSpacing(),
+ isBarSpacingRelative());
emit barThicknessChanged(thicknessRatio);
}
}
-float Q3DBars::barThickness()
+float Q3DBars::barThickness() const
{
- return dptr()->m_shared->barThickness();
+ return dptrc()->m_shared->barThickness();
}
/*!
@@ -236,9 +228,9 @@ float Q3DBars::barThickness()
* Bar spacing, which is the empty space between bars, in X and Z dimensions. It is preset to
* \c {(1.0, 1.0)} by default. Spacing is affected by barSpacingRelative -property.
*
- * \sa barSpacingRelative
+ * \sa barSpacingRelative, multiSeriesUniform
*/
-void Q3DBars::setBarSpacing(QSizeF spacing)
+void Q3DBars::setBarSpacing(const QSizeF &spacing)
{
if (spacing != barSpacing()) {
dptr()->m_shared->setBarSpecs(GLfloat(barThickness()), spacing, isBarSpacingRelative());
@@ -246,9 +238,9 @@ void Q3DBars::setBarSpacing(QSizeF spacing)
}
}
-QSizeF Q3DBars::barSpacing()
+QSizeF Q3DBars::barSpacing() const
{
- return dptr()->m_shared->barSpacing();
+ return dptrc()->m_shared->barSpacing();
}
/*!
@@ -266,76 +258,15 @@ void Q3DBars::setBarSpacingRelative(bool relative)
}
}
-bool Q3DBars::isBarSpacingRelative()
-{
- return dptr()->m_shared->isBarSpecRelative();
-}
-
-/*!
- * \property Q3DBars::theme
- *
- * A \a theme to be used for the graph. Ownership of the \a theme is transferred. Previous theme
- * is deleted when a new one is set. Properties of the \a theme can be modified even after setting
- * it, and the modifications take effect immediately.
- */
-void Q3DBars::setTheme(Q3DTheme *theme)
-{
- dptr()->m_shared->setTheme(theme);
-}
-
-Q3DTheme *Q3DBars::theme() const
+bool Q3DBars::isBarSpacingRelative() const
{
- return dptrc()->m_shared->theme();
+ return dptrc()->m_shared->isBarSpecRelative();
}
/*!
- * \property Q3DBars::selectionMode
+ * \property Q3DBars::rowAxis
*
- * Sets bar selection \a mode to a combination of \c QDataVis::SelectionFlags. It is preset to
- * \c QDataVis::SelectionItem by default.
- */
-void Q3DBars::setSelectionMode(QDataVis::SelectionFlags mode)
-{
- dptr()->m_shared->setSelectionMode(mode);
-}
-
-QDataVis::SelectionFlags Q3DBars::selectionMode() const
-{
- return dptrc()->m_shared->selectionMode();
-}
-
-/*!
- * \property Q3DBars::scene
- *
- * This property contains the read only Q3DScene that can be used to access e.g. camera object.
- */
-Q3DScene *Q3DBars::scene() const
-{
- return dptrc()->m_shared->scene();
-}
-
-/*!
- * \property Q3DBars::shadowQuality
- *
- * Sets shadow \a quality to one of \c QDataVis::ShadowQuality. It is preset to
- * \c QDataVis::ShadowQualityMedium by default.
- *
- * \note If setting QDataVis::ShadowQuality of a certain level fails, a level is lowered
- * until it is successful and shadowQualityChanged signal is emitted for each time the change is
- * done.
- */
-void Q3DBars::setShadowQuality(QDataVis::ShadowQuality quality)
-{
- dptr()->m_shared->setShadowQuality(quality);
-}
-
-QDataVis::ShadowQuality Q3DBars::shadowQuality() const
-{
- return dptrc()->m_shared->shadowQuality();
-}
-
-/*!
- * Sets a user-defined row \a axis. Implicitly calls addAxis() to transfer ownership of
+ * The active row \a axis. Implicitly calls addAxis() to transfer ownership of
* the \a axis to this graph.
*
* If the \a axis is null, a temporary default axis with no labels is created.
@@ -343,21 +274,20 @@ QDataVis::ShadowQuality Q3DBars::shadowQuality() const
*
* \sa addAxis(), releaseAxis()
*/
-void Q3DBars::setRowAxis(Q3DCategoryAxis *axis)
+void Q3DBars::setRowAxis(QCategory3DAxis *axis)
{
dptr()->m_shared->setAxisZ(axis);
}
-/*!
- * \return category axis for rows.
- */
-Q3DCategoryAxis *Q3DBars::rowAxis() const
+QCategory3DAxis *Q3DBars::rowAxis() const
{
- return static_cast<Q3DCategoryAxis *>(dptrc()->m_shared->axisZ());
+ return static_cast<QCategory3DAxis *>(dptrc()->m_shared->axisZ());
}
/*!
- * Sets a user-defined column \a axis. Implicitly calls addAxis() to transfer ownership of
+ * \property Q3DBars::columnAxis
+ *
+ * The active column \a axis. Implicitly calls addAxis() to transfer ownership of
* the \a axis to this graph.
*
* If the \a axis is null, a temporary default axis with no labels is created.
@@ -365,21 +295,20 @@ Q3DCategoryAxis *Q3DBars::rowAxis() const
*
* \sa addAxis(), releaseAxis()
*/
-void Q3DBars::setColumnAxis(Q3DCategoryAxis *axis)
+void Q3DBars::setColumnAxis(QCategory3DAxis *axis)
{
dptr()->m_shared->setAxisX(axis);
}
-/*!
- * \return category axis for columns.
- */
-Q3DCategoryAxis *Q3DBars::columnAxis() const
+QCategory3DAxis *Q3DBars::columnAxis() const
{
- return static_cast<Q3DCategoryAxis *>(dptrc()->m_shared->axisX());
+ return static_cast<QCategory3DAxis *>(dptrc()->m_shared->axisX());
}
/*!
- * Sets a user-defined value \a axis (the Y-axis). Implicitly calls addAxis() to transfer ownership
+ * \property Q3DBars::valueAxis
+ *
+ * The active value \a axis (the Y-axis). Implicitly calls addAxis() to transfer ownership
* of the \a axis to this graph.
*
* If the \a axis is null, a temporary default axis with no labels and automatically adjusting
@@ -388,17 +317,14 @@ Q3DCategoryAxis *Q3DBars::columnAxis() const
*
* \sa addAxis(), releaseAxis()
*/
-void Q3DBars::setValueAxis(Q3DValueAxis *axis)
+void Q3DBars::setValueAxis(QValue3DAxis *axis)
{
dptr()->m_shared->setAxisY(axis);
}
-/*!
- * \return used value axis (Y-axis).
- */
-Q3DValueAxis *Q3DBars::valueAxis() const
+QValue3DAxis *Q3DBars::valueAxis() const
{
- return static_cast<Q3DValueAxis *>(dptrc()->m_shared->axisY());
+ return static_cast<QValue3DAxis *>(dptrc()->m_shared->axisY());
}
/*!
@@ -408,7 +334,7 @@ Q3DValueAxis *Q3DBars::valueAxis() const
*
* \sa releaseAxis(), setValueAxis(), setRowAxis(), setColumnAxis()
*/
-void Q3DBars::addAxis(Q3DAbstractAxis *axis)
+void Q3DBars::addAxis(QAbstract3DAxis *axis)
{
dptr()->m_shared->addAxis(axis);
}
@@ -421,7 +347,7 @@ void Q3DBars::addAxis(Q3DAbstractAxis *axis)
*
* \sa addAxis(), setValueAxis(), setRowAxis(), setColumnAxis()
*/
-void Q3DBars::releaseAxis(Q3DAbstractAxis *axis)
+void Q3DBars::releaseAxis(QAbstract3DAxis *axis)
{
dptr()->m_shared->releaseAxis(axis);
}
@@ -431,24 +357,43 @@ void Q3DBars::releaseAxis(Q3DAbstractAxis *axis)
*
* \sa addAxis()
*/
-QList<Q3DAbstractAxis *> Q3DBars::axes() const
+QList<QAbstract3DAxis *> Q3DBars::axes() const
{
return dptrc()->m_shared->axes();
}
+Q3DBarsPrivate *Q3DBars::dptr()
+{
+ return static_cast<Q3DBarsPrivate *>(d_ptr.data());
+}
+
+const Q3DBarsPrivate *Q3DBars::dptrc() const
+{
+ return static_cast<const Q3DBarsPrivate *>(d_ptr.data());
+}
+
Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q)
- : Q3DWindowPrivate(q)
+ : QAbstract3DGraphPrivate(q)
{
}
Q3DBarsPrivate::~Q3DBarsPrivate()
{
- delete m_shared;
}
-void Q3DBarsPrivate::handleShadowQualityUpdate(QDataVis::ShadowQuality quality)
+void Q3DBarsPrivate::handleAxisXChanged(QAbstract3DAxis *axis)
+{
+ emit qptr()->columnAxisChanged(static_cast<QCategory3DAxis *>(axis));
+}
+
+void Q3DBarsPrivate::handleAxisYChanged(QAbstract3DAxis *axis)
+{
+ emit qptr()->valueAxisChanged(static_cast<QValue3DAxis *>(axis));
+}
+
+void Q3DBarsPrivate::handleAxisZChanged(QAbstract3DAxis *axis)
{
- emit qptr()->shadowQualityChanged(quality);
+ emit qptr()->rowAxisChanged(static_cast<QCategory3DAxis *>(axis));
}
Q3DBars *Q3DBarsPrivate::qptr()