diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-10 17:48:55 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-11 09:00:45 +0200 |
commit | a7b80c0b6176692ee2b7abdce7acdc5c37a72d00 (patch) | |
tree | 6d4835511c823e1ebff312869e51c9ff949f85ad | |
parent | c121fb4ad00bc9617a011e040ef5ed695610a504 (diff) | |
parent | 64d931d5fc5f17b8c4875f6c59f900aa59080881 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/charts/glwidget.cpp
src/charts/xychart/glxyseriesdata_p.h
src/chartsqml2/declarativerendernode.cpp
Change-Id: I611ff3a7874ceb7dddcf0f4d069927a9899a986d
63 files changed, 593 insertions, 426 deletions
diff --git a/examples/charts/areachart/areachart.pro b/examples/charts/areachart/areachart.pro index e8e1a074..96e138ab 100644 --- a/examples/charts/areachart/areachart.pro +++ b/examples/charts/areachart/areachart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = areachart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/areachart +INSTALLS += target diff --git a/examples/charts/audio/audio.pro b/examples/charts/audio/audio.pro index 6a3b6917..c6df9be0 100644 --- a/examples/charts/audio/audio.pro +++ b/examples/charts/audio/audio.pro @@ -1,15 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts multimedia -QT += multimedia - -TARGET = audio -TEMPLATE = app +HEADERS += \ + widget.h \ + xyseriesiodevice.h -SOURCES += main.cpp\ - widget.cpp \ +SOURCES += \ + main.cpp\ + widget.cpp \ xyseriesiodevice.cpp -HEADERS += widget.h \ - xyseriesiodevice.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/audio +INSTALLS += target diff --git a/examples/charts/barchart/barchart.pro b/examples/charts/barchart/barchart.pro index 14db3c88..eaa7a037 100644 --- a/examples/charts/barchart/barchart.pro +++ b/examples/charts/barchart/barchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = barchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/barchart +INSTALLS += target diff --git a/examples/charts/barmodelmapper/barmodelmapper.pro b/examples/charts/barmodelmapper/barmodelmapper.pro index 91b8f367..45a5e224 100644 --- a/examples/charts/barmodelmapper/barmodelmapper.pro +++ b/examples/charts/barmodelmapper/barmodelmapper.pro @@ -1,16 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -QT += core gui +HEADERS += \ + customtablemodel.h \ + tablewidget.h -TARGET = barmodelmapper -TEMPLATE = app +SOURCES += \ + customtablemodel.cpp \ + main.cpp \ + tablewidget.cpp - -SOURCES += main.cpp\ - tablewidget.cpp \ - customtablemodel.cpp - -HEADERS += tablewidget.h \ - customtablemodel.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/barmodelmapper +INSTALLS += target diff --git a/examples/charts/boxplotchart/boxplotchart.pro b/examples/charts/boxplotchart/boxplotchart.pro index c2483511..10ed4515 100644 --- a/examples/charts/boxplotchart/boxplotchart.pro +++ b/examples/charts/boxplotchart/boxplotchart.pro @@ -1,13 +1,14 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = boxplotchart -SOURCES += main.cpp \ - boxdatareader.cpp +HEADERS += \ + boxdatareader.h + +SOURCES += \ + boxdatareader.cpp \ + main.cpp \ RESOURCES += \ boxplotdata.qrc -HEADERS += \ - boxdatareader.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/boxplotchart +INSTALLS += target diff --git a/examples/charts/callout/callout.pro b/examples/charts/callout/callout.pro index b0da66d6..688b69e9 100644 --- a/examples/charts/callout/callout.pro +++ b/examples/charts/callout/callout.pro @@ -1,15 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = callout -TEMPLATE = app +HEADERS += \ + callout.h \ + view.h SOURCES += \ - main.cpp\ - callout.cpp \ - view.cpp + callout.cpp \ + main.cpp\ + view.cpp -HEADERS += \ - callout.h \ - view.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/callout +INSTALLS += target diff --git a/examples/charts/chartinteractions/chartinteractions.pro b/examples/charts/chartinteractions/chartinteractions.pro index 8cf4c36c..4027eb3c 100644 --- a/examples/charts/chartinteractions/chartinteractions.pro +++ b/examples/charts/chartinteractions/chartinteractions.pro @@ -1,11 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -QT += core gui +HEADERS += \ + chart.h \ + chartview.h -TARGET = chartinteractions -TEMPLATE = app +SOURCES += \ + chart.cpp \ + chartview.cpp \ + main.cpp -HEADERS += chart.h chartview.h -SOURCES += main.cpp chart.cpp chartview.cpp +target.path = $$[QT_INSTALL_EXAMPLES]/charts/chartinteractions +INSTALLS += target diff --git a/examples/charts/charts.pro b/examples/charts/charts.pro index 5caa03c6..1db961a7 100644 --- a/examples/charts/charts.pro +++ b/examples/charts/charts.pro @@ -1,50 +1,53 @@ TEMPLATE = subdirs -SUBDIRS += areachart \ +SUBDIRS += \ + areachart \ + barchart \ + barmodelmapper \ + boxplotchart \ + callout \ + chartinteractions \ + chartthemes \ customchart \ + donutbreakdown \ + donutchart \ + dynamicspline \ + horizontalbarchart \ + horizontalpercentbarchart \ + horizontalstackedbarchart \ + legend \ + legendmarkers \ + lineandbar \ linechart \ + logvalueaxis \ + modeldata \ + multiaxis \ + nesteddonuts \ percentbarchart \ piechart \ + piechartcustomization \ piechartdrilldown \ + polarchart \ scatterchart \ scatterinteractions \ splinechart \ stackedbarchart \ stackedbarchartdrilldown \ - zoomlinechart \ - modeldata \ - barchart \ - boxplotchart \ - legend \ - barmodelmapper \ - lineandbar \ - horizontalbarchart \ - horizontalstackedbarchart \ - horizontalpercentbarchart \ - donutbreakdown \ temperaturerecords \ - donutchart \ - multiaxis \ - legendmarkers \ - logvalueaxis \ - polarchart \ - piechartcustomization \ - dynamicspline \ - nesteddonuts \ - chartinteractions \ - callout \ - chartthemes + zoomlinechart qtHaveModule(quick) { - SUBDIRS += qmlboxplot \ - qmlpiechart \ - qmlweather \ - qmlf1legends \ - qmlcustomizations \ + SUBDIRS += \ qmlaxes \ + qmlboxplot \ + qmlchart \ + qmlcustomizations \ qmlcustomlegend \ + qmlf1legends \ + qmloscilloscope \ + qmlpiechart \ qmlpolarchart \ - qmlchart \ - qmloscilloscope + qmlweather + } qtHaveModule(multimedia) { diff --git a/examples/charts/chartthemes/chartthemes.pro b/examples/charts/chartthemes/chartthemes.pro index 2a414557..5985f55c 100644 --- a/examples/charts/chartthemes/chartthemes.pro +++ b/examples/charts/chartthemes/chartthemes.pro @@ -1,7 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = chartthemes -SOURCES = main.cpp themewidget.cpp -HEADERS = themewidget.h +HEADERS += \ + themewidget.h + +SOURCES += \ + main.cpp \ + themewidget.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/chartthemes +INSTALLS += target diff --git a/examples/charts/customchart/customchart.pro b/examples/charts/customchart/customchart.pro index 5f3f7382..e82b94ae 100644 --- a/examples/charts/customchart/customchart.pro +++ b/examples/charts/customchart/customchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = customchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/customchart +INSTALLS += target diff --git a/examples/charts/datetimeaxis/datetimeaxis.pro b/examples/charts/datetimeaxis/datetimeaxis.pro index 0ec9d715..09869b05 100644 --- a/examples/charts/datetimeaxis/datetimeaxis.pro +++ b/examples/charts/datetimeaxis/datetimeaxis.pro @@ -1,8 +1,10 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = datetimeaxis -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp RESOURCES += \ sundata.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/datetimeaxis +INSTALLS += target diff --git a/examples/charts/donutbreakdown/donutbreakdown.pro b/examples/charts/donutbreakdown/donutbreakdown.pro index fecef7b8..85ef9d3a 100644 --- a/examples/charts/donutbreakdown/donutbreakdown.pro +++ b/examples/charts/donutbreakdown/donutbreakdown.pro @@ -1,12 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = donutbreakdown -SOURCES += main.cpp\ +HEADERS += \ + donutbreakdownchart.h \ + mainslice.h + +SOURCES += \ donutbreakdownchart.cpp \ + main.cpp \ mainslice.cpp -HEADERS += \ - donutbreakdownchart.h \ - mainslice.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/donutbreakdown +INSTALLS += target diff --git a/examples/charts/donutchart/donutchart.pro b/examples/charts/donutchart/donutchart.pro index 72d4ea4d..71017d12 100644 --- a/examples/charts/donutchart/donutchart.pro +++ b/examples/charts/donutchart/donutchart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = donutchart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/donutchart +INSTALLS += target diff --git a/examples/charts/dynamicspline/dynamicspline.pro b/examples/charts/dynamicspline/dynamicspline.pro index feb26895..1aedeca4 100644 --- a/examples/charts/dynamicspline/dynamicspline.pro +++ b/examples/charts/dynamicspline/dynamicspline.pro @@ -1,7 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = dynamicspline -HEADERS += chart.h -SOURCES += main.cpp chart.cpp +HEADERS += \ + chart.h + +SOURCES += \ + chart.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/dynamicspline +INSTALLS += target diff --git a/examples/charts/examples.pri b/examples/charts/examples.pri deleted file mode 100644 index 7b2eaaa7..00000000 --- a/examples/charts/examples.pri +++ /dev/null @@ -1,17 +0,0 @@ - -INCLUDEPATH += ../../../include - -LIBS += -L$$OUT_PWD/../../../lib - -TEMPLATE = app - -QT += charts -QT += core gui widgets - -contains(TARGET, qml.*) { - QT += qml quick -} - -target.path = $$[QT_INSTALL_EXAMPLES]/charts/$$TARGET -INSTALLS += target - diff --git a/examples/charts/horizontalbarchart/horizontalbarchart.pro b/examples/charts/horizontalbarchart/horizontalbarchart.pro index 61ec088e..f0acf2bc 100644 --- a/examples/charts/horizontalbarchart/horizontalbarchart.pro +++ b/examples/charts/horizontalbarchart/horizontalbarchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = horizontalbarchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/horizontalbarchart +INSTALLS += target diff --git a/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro b/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro index d6168695..5bd65774 100644 --- a/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro +++ b/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = horizontalpercentbarchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/horizontalpercentbarchart +INSTALLS += target diff --git a/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro b/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro index 5c08d212..b6ba1612 100644 --- a/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro +++ b/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = horizontalstackedbarchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/horizontalstackedbarchart +INSTALLS += target diff --git a/examples/charts/legend/legend.pro b/examples/charts/legend/legend.pro index 5e22fb2a..5e832ed8 100644 --- a/examples/charts/legend/legend.pro +++ b/examples/charts/legend/legend.pro @@ -1,10 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -TARGET = legend -SOURCES += main.cpp \ - mainwidget.cpp +QT += charts HEADERS += \ mainwidget.h + +SOURCES += \ + main.cpp \ + mainwidget.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/legend +INSTALLS += target diff --git a/examples/charts/legendmarkers/legendmarkers.pro b/examples/charts/legendmarkers/legendmarkers.pro index f79bdba4..169393e0 100644 --- a/examples/charts/legendmarkers/legendmarkers.pro +++ b/examples/charts/legendmarkers/legendmarkers.pro @@ -1,10 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -TARGET = legendmarkers -SOURCES += main.cpp \ - mainwidget.cpp +QT += charts HEADERS += \ mainwidget.h + +SOURCES += \ + main.cpp \ + mainwidget.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/legendmarkers +INSTALLS += target diff --git a/examples/charts/lineandbar/lineandbar.pro b/examples/charts/lineandbar/lineandbar.pro index dd94abd5..073cca49 100644 --- a/examples/charts/lineandbar/lineandbar.pro +++ b/examples/charts/lineandbar/lineandbar.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = lineandbar -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/lineandbar +INSTALLS += target diff --git a/examples/charts/linechart/linechart.pro b/examples/charts/linechart/linechart.pro index d3eb640a..71f70965 100644 --- a/examples/charts/linechart/linechart.pro +++ b/examples/charts/linechart/linechart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = linechart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/linechart +INSTALLS += target diff --git a/examples/charts/logvalueaxis/logvalueaxis.pro b/examples/charts/logvalueaxis/logvalueaxis.pro index ede43079..196a062a 100644 --- a/examples/charts/logvalueaxis/logvalueaxis.pro +++ b/examples/charts/logvalueaxis/logvalueaxis.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = logvalueaxis -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/logvalueaxis +INSTALLS += target diff --git a/examples/charts/modeldata/modeldata.pro b/examples/charts/modeldata/modeldata.pro index 7c302bd9..95d3d689 100644 --- a/examples/charts/modeldata/modeldata.pro +++ b/examples/charts/modeldata/modeldata.pro @@ -1,16 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -QT += core gui +HEADERS += \ + customtablemodel.h \ + tablewidget.h -TARGET = modeldata -TEMPLATE = app +SOURCES += \ + customtablemodel.cpp \ + main.cpp \ + tablewidget.cpp - -SOURCES += main.cpp\ - tablewidget.cpp \ - customtablemodel.cpp - -HEADERS += tablewidget.h \ - customtablemodel.h +target.path = $$[QT_INSTALL_EXAMPLES]/charts/modeldata +INSTALLS += target diff --git a/examples/charts/multiaxis/multiaxis.pro b/examples/charts/multiaxis/multiaxis.pro index 33de57cb..9edca6ba 100644 --- a/examples/charts/multiaxis/multiaxis.pro +++ b/examples/charts/multiaxis/multiaxis.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = multiaxis -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/multiaxis +INSTALLS += target diff --git a/examples/charts/nesteddonuts/nesteddonuts.pro b/examples/charts/nesteddonuts/nesteddonuts.pro index fadab0cd..571f1a06 100644 --- a/examples/charts/nesteddonuts/nesteddonuts.pro +++ b/examples/charts/nesteddonuts/nesteddonuts.pro @@ -1,8 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = nesteddonuts -SOURCES += main.cpp\ - widget.cpp -HEADERS += widget.h +HEADERS += \ + widget.h + +SOURCES += \ + main.cpp \ + widget.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/nesteddonuts +INSTALLS += target diff --git a/examples/charts/openglseries/openglseries.pro b/examples/charts/openglseries/openglseries.pro index 0ae11595..e0c13cfe 100644 --- a/examples/charts/openglseries/openglseries.pro +++ b/examples/charts/openglseries/openglseries.pro @@ -1,9 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = openglseries -SOURCES += main.cpp \ - datasource.cpp -HEADERS += datasource.h +HEADERS += \ + datasource.h +SOURCES += \ + datasource.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/openglseries +INSTALLS += target diff --git a/examples/charts/percentbarchart/percentbarchart.pro b/examples/charts/percentbarchart/percentbarchart.pro index 983159d1..cfb718b0 100644 --- a/examples/charts/percentbarchart/percentbarchart.pro +++ b/examples/charts/percentbarchart/percentbarchart.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = percentbarchart -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/percentbarchart +INSTALLS += target diff --git a/examples/charts/piechart/piechart.pro b/examples/charts/piechart/piechart.pro index 7bd48514..e3767910 100644 --- a/examples/charts/piechart/piechart.pro +++ b/examples/charts/piechart/piechart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = piechart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/piechart +INSTALLS += target diff --git a/examples/charts/piechartcustomization/piechartcustomization.pro b/examples/charts/piechartcustomization/piechartcustomization.pro index 722744de..081e9105 100644 --- a/examples/charts/piechartcustomization/piechartcustomization.pro +++ b/examples/charts/piechartcustomization/piechartcustomization.pro @@ -1,16 +1,17 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -TARGET = piechartcustomization -SOURCES += main.cpp \ - pentool.cpp \ - brushtool.cpp \ - customslice.cpp \ - mainwidget.cpp +QT += charts HEADERS += \ - pentool.h \ brushtool.h \ customslice.h \ - mainwidget.h + mainwidget.h \ + pentool.h + +SOURCES += \ + brushtool.cpp \ + customslice.cpp \ + main.cpp \ + mainwidget.cpp \ + pentool.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/piechartcustomization +INSTALLS += target diff --git a/examples/charts/piechartdrilldown/piechartdrilldown.pro b/examples/charts/piechartdrilldown/piechartdrilldown.pro index 0f9626c9..60866fc3 100644 --- a/examples/charts/piechartdrilldown/piechartdrilldown.pro +++ b/examples/charts/piechartdrilldown/piechartdrilldown.pro @@ -1,11 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = piechartdrilldown -SOURCES += main.cpp \ - drilldownslice.cpp \ - drilldownchart.cpp +QT += charts HEADERS += \ drilldownchart.h \ drilldownslice.h + +SOURCES += \ + drilldownchart.cpp \ + drilldownslice.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/piechartdrilldown +INSTALLS += target diff --git a/examples/charts/polarchart/polarchart.pro b/examples/charts/polarchart/polarchart.pro index 8759c1ce..a046ca86 100644 --- a/examples/charts/polarchart/polarchart.pro +++ b/examples/charts/polarchart/polarchart.pro @@ -1,6 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = polarchart -SOURCES += main.cpp chartview.cpp -HEADERS += chartview.h +QT += charts + +HEADERS += \ + chartview.h + +SOURCES += \ + chartview.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/polarchart +INSTALLS += target diff --git a/examples/charts/qmlaxes/qmlaxes.pro b/examples/charts/qmlaxes/qmlaxes.pro index 50b4c012..6fb5b4f9 100644 --- a/examples/charts/qmlaxes/qmlaxes.pro +++ b/examples/charts/qmlaxes/qmlaxes.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlaxes/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlaxes/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlaxes +INSTALLS += target diff --git a/examples/charts/qmlboxplot/qmlboxplot.pro b/examples/charts/qmlboxplot/qmlboxplot.pro index 237f05f1..3afed6af 100644 --- a/examples/charts/qmlboxplot/qmlboxplot.pro +++ b/examples/charts/qmlboxplot/qmlboxplot.pro @@ -1,9 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp +SOURCES += \ + main.cpp -OTHER_FILES += \ - qml/qmlboxplot/main.qml +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlboxplot/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlboxplot +INSTALLS += target diff --git a/examples/charts/qmlchart/qmlchart.pro b/examples/charts/qmlchart/qmlchart.pro index 82426424..f665ee12 100644 --- a/examples/charts/qmlchart/qmlchart.pro +++ b/examples/charts/qmlchart/qmlchart.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlchart/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlchart/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlchart +INSTALLS += target diff --git a/examples/charts/qmlcustomizations/qmlcustomizations.pro b/examples/charts/qmlcustomizations/qmlcustomizations.pro index ae2d4e5b..a2d316d6 100644 --- a/examples/charts/qmlcustomizations/qmlcustomizations.pro +++ b/examples/charts/qmlcustomizations/qmlcustomizations.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlcustomizations/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlcustomizations/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlcustomizations +INSTALLS += target diff --git a/examples/charts/qmlcustomlegend/qmlcustomlegend.pro b/examples/charts/qmlcustomlegend/qmlcustomlegend.pro index d42afded..478b68ac 100644 --- a/examples/charts/qmlcustomlegend/qmlcustomlegend.pro +++ b/examples/charts/qmlcustomlegend/qmlcustomlegend.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlcustomlegend/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlcustomlegend/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlcustomlegend +INSTALLS += target diff --git a/examples/charts/qmlf1legends/qmlf1legends.pro b/examples/charts/qmlf1legends/qmlf1legends.pro index fc8c04f4..a3081f15 100644 --- a/examples/charts/qmlf1legends/qmlf1legends.pro +++ b/examples/charts/qmlf1legends/qmlf1legends.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlf1legends/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlf1legends/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlf1legends +INSTALLS += target diff --git a/examples/charts/qmloscilloscope/qmloscilloscope.pro b/examples/charts/qmloscilloscope/qmloscilloscope.pro index a66fabcd..34ef74db 100644 --- a/examples/charts/qmloscilloscope/qmloscilloscope.pro +++ b/examples/charts/qmloscilloscope/qmloscilloscope.pro @@ -1,11 +1,17 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -RESOURCES += resources.qrc -SOURCES += main.cpp \ - datasource.cpp -OTHER_FILES += qml/qmloscilloscope/* +QT += charts qml quick HEADERS += \ datasource.h + +SOURCES += \ + main.cpp \ + datasource.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmloscilloscope/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmloscilloscope +INSTALLS += target diff --git a/examples/charts/qmlpiechart/qmlpiechart.pro b/examples/charts/qmlpiechart/qmlpiechart.pro index 926f9c2d..7f87bb1a 100644 --- a/examples/charts/qmlpiechart/qmlpiechart.pro +++ b/examples/charts/qmlpiechart/qmlpiechart.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlpiechart/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlpiechart/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlpiechart +INSTALLS += target diff --git a/examples/charts/qmlpolarchart/qmlpolarchart.pro b/examples/charts/qmlpolarchart/qmlpolarchart.pro index aa3341a5..340fbf86 100644 --- a/examples/charts/qmlpolarchart/qmlpolarchart.pro +++ b/examples/charts/qmlpolarchart/qmlpolarchart.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlpolarchart/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlpolarchart/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlpolarchart +INSTALLS += target diff --git a/examples/charts/qmlweather/qmlweather.pro b/examples/charts/qmlweather/qmlweather.pro index 5e0d8df4..f51e6c8f 100644 --- a/examples/charts/qmlweather/qmlweather.pro +++ b/examples/charts/qmlweather/qmlweather.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts qml quick -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/qmlweather/* +SOURCES += \ + main.cpp + +RESOURCES += \ + resources.qrc + +DISTFILES += \ + qml/qmlweather/* + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/qmlweather +INSTALLS += target diff --git a/examples/charts/scatterchart/scatterchart.pro b/examples/charts/scatterchart/scatterchart.pro index 8170d6f4..fdb468d6 100644 --- a/examples/charts/scatterchart/scatterchart.pro +++ b/examples/charts/scatterchart/scatterchart.pro @@ -1,9 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = scatterchart -SOURCES += main.cpp \ - chartview.cpp +QT += charts HEADERS += \ chartview.h + +SOURCES += \ + chartview.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/scatterchart +INSTALLS += target diff --git a/examples/charts/scatterinteractions/scatterinteractions.pro b/examples/charts/scatterinteractions/scatterinteractions.pro index 596fe020..e069df7f 100644 --- a/examples/charts/scatterinteractions/scatterinteractions.pro +++ b/examples/charts/scatterinteractions/scatterinteractions.pro @@ -1,9 +1,11 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = scatterinteractions -SOURCES += main.cpp \ - chartview.cpp -HEADERS += \ +HEADERS += \ chartview.h + +SOURCES += \ + chartview.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/scatterinteractions +INSTALLS += target diff --git a/examples/charts/splinechart/splinechart.pro b/examples/charts/splinechart/splinechart.pro index b2624f53..e71b7780 100644 --- a/examples/charts/splinechart/splinechart.pro +++ b/examples/charts/splinechart/splinechart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = splinechart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/splinechart +INSTALLS += target diff --git a/examples/charts/stackedbarchart/stackedbarchart.pro b/examples/charts/stackedbarchart/stackedbarchart.pro index f6a77b6a..1034c61d 100644 --- a/examples/charts/stackedbarchart/stackedbarchart.pro +++ b/examples/charts/stackedbarchart/stackedbarchart.pro @@ -1,5 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = stackedbarchart -SOURCES += main.cpp +QT += charts + +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/stackedbarchart +INSTALLS += target diff --git a/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro b/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro index c10066f4..7cd09466 100644 --- a/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro +++ b/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro @@ -1,6 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = stackedbarchartdrilldown -SOURCES += main.cpp drilldownseries.cpp drilldownchart.cpp -HEADERS += drilldownseries.h drilldownchart.h +QT += charts + +HEADERS += \ + drilldownchart.h \ + drilldownseries.h + +SOURCES += \ + drilldownchart.cpp \ + drilldownseries.cpp \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/stackedbarchartdrilldown +INSTALLS += target diff --git a/examples/charts/temperaturerecords/temperaturerecords.pro b/examples/charts/temperaturerecords/temperaturerecords.pro index e2eb6be3..b8f34907 100644 --- a/examples/charts/temperaturerecords/temperaturerecords.pro +++ b/examples/charts/temperaturerecords/temperaturerecords.pro @@ -1,6 +1,7 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} +QT += charts -TARGET = temperaturerecords -SOURCES += main.cpp +SOURCES += \ + main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/temperaturerecords +INSTALLS += target diff --git a/examples/charts/zoomlinechart/zoomlinechart.pro b/examples/charts/zoomlinechart/zoomlinechart.pro index c98161b2..a9f38f14 100644 --- a/examples/charts/zoomlinechart/zoomlinechart.pro +++ b/examples/charts/zoomlinechart/zoomlinechart.pro @@ -1,7 +1,13 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} -TARGET = zoomlinechart -HEADERS += chart.h chartview.h - -SOURCES += main.cpp chart.cpp chartview.cpp +QT += charts + +HEADERS += \ + chart.h \ + chartview.h + +SOURCES += \ + main.cpp \ + chart.cpp \ + chartview.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/zoomlinechart +INSTALLS += target diff --git a/src/charts/barchart/qbarset.cpp b/src/charts/barchart/qbarset.cpp index f62fc806..c065787f 100644 --- a/src/charts/barchart/qbarset.cpp +++ b/src/charts/barchart/qbarset.cpp @@ -280,12 +280,19 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \qmlproperty QVariantList BarSet::values - The values of the bar set. You can set either a list of reals or a list of points as values. If you set a list of - reals as values, the values are automatically completed to points by using the index of a value as it's - x-coordinate. For example the following sets have equal values: + The values of the bar set. You can set either a list of reals or a list of points as values. + + If you set a list of reals as values, the values directly define the bar set values. + + If you set a list of points as values, the x-coordinate of the point specifies its zero-based + index in the bar set. The size of the bar set is the highest x-coordinate value + 1. + If a point is missing for any x-coordinate between zero and the highest value, + it gets value zero. + + For example the following sets have equal values: \code - myBarSet1.values = [0, 5, 1, 5]; - myBarSet2.values = [Qt.point(0, 0), Qt.point(1, 5), Qt.point(2, 1), Qt.point(3, 5)]; + myBarSet1.values = [5, 0, 1, 5]; + myBarSet2.values = [Qt.point(0, 5), Qt.point(2, 1), Qt.point(3, 5)]; \endcode */ diff --git a/src/charts/glwidget.cpp b/src/charts/glwidget.cpp index c0070dcd..189a2894 100644 --- a/src/charts/glwidget.cpp +++ b/src/charts/glwidget.cpp @@ -178,31 +178,33 @@ void GLWidget::paintGL() QOpenGLBuffer *vbo = m_seriesBufferMap.value(i.key()); GLXYSeriesData *data = i.value(); - m_program->setUniformValue(m_colorUniformLoc, data->color); - m_program->setUniformValue(m_minUniformLoc, data->min); - m_program->setUniformValue(m_deltaUniformLoc, data->delta); - m_program->setUniformValue(m_matrixUniformLoc, data->matrix); - - if (!vbo) { - vbo = new QOpenGLBuffer; - m_seriesBufferMap.insert(i.key(), vbo); - vbo->create(); + if (data->visible) { + m_program->setUniformValue(m_colorUniformLoc, data->color); + m_program->setUniformValue(m_minUniformLoc, data->min); + m_program->setUniformValue(m_deltaUniformLoc, data->delta); + m_program->setUniformValue(m_matrixUniformLoc, data->matrix); + + if (!vbo) { + vbo = new QOpenGLBuffer; + m_seriesBufferMap.insert(i.key(), vbo); + vbo->create(); + } + vbo->bind(); + if (data->dirty) { + vbo->allocate(data->array.constData(), data->array.count() * sizeof(GLfloat)); + data->dirty = false; + } + + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); + if (data->type == QAbstractSeries::SeriesTypeLine) { + glLineWidth(data->width); + glDrawArrays(GL_LINE_STRIP, 0, data->array.size() / 2); + } else { // Scatter + m_program->setUniformValue(m_pointSizeUniformLoc, data->width); + glDrawArrays(GL_POINTS, 0, data->array.size() / 2); + } + vbo->release(); } - vbo->bind(); - if (data->dirty) { - vbo->allocate(data->array.constData(), data->array.count() * sizeof(GLfloat)); - data->dirty = false; - } - - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); - if (data->type == QAbstractSeries::SeriesTypeLine) { - glLineWidth(data->width); - glDrawArrays(GL_LINE_STRIP, 0, data->array.size() / 2); - } else { // Scatter - m_program->setUniformValue(m_pointSizeUniformLoc, data->width); - glDrawArrays(GL_POINTS, 0, data->array.size() / 2); - } - vbo->release(); } #ifdef QDEBUG_TRACE_GL_FPS diff --git a/src/charts/layout/cartesianchartlayout.cpp b/src/charts/layout/cartesianchartlayout.cpp index 7a3d8638..80a852a7 100644 --- a/src/charts/layout/cartesianchartlayout.cpp +++ b/src/charts/layout/cartesianchartlayout.cpp @@ -233,11 +233,11 @@ QRectF CartesianChartLayout::calculateAxisMinimum(const QRectF &minimum, const Q switch (axis->axis()->alignment()) { case Qt::AlignLeft: left.setWidth(left.width() + size.width()); - left.setHeight(qMax(left.height() * 2, size.height())); + left.setHeight(qMax(left.height(), size.height())); break; case Qt::AlignRight: right.setWidth(right.width() + size.width()); - right.setHeight(qMax(right.height() * 2, size.height())); + right.setHeight(qMax(right.height(), size.height())); break; case Qt::AlignTop: top.setWidth(qMax(top.width(), size.width())); diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp index afb1284d..ab1e8a47 100644 --- a/src/charts/linechart/linechartitem.cpp +++ b/src/charts/linechart/linechartitem.cpp @@ -347,6 +347,7 @@ void LineChartItem::handleUpdated() bool doGeometryUpdate = (m_pointsVisible != m_series->pointsVisible()) || (m_series->pointsVisible() && (m_linePen != m_series->pen())); + bool visibleChanged = m_series->isVisible() != isVisible(); setVisible(m_series->isVisible()); setOpacity(m_series->opacity()); m_pointsVisible = m_series->pointsVisible(); @@ -358,6 +359,8 @@ void LineChartItem::handleUpdated() m_pointLabelsClipping = m_series->pointLabelsClipping(); if (doGeometryUpdate) updateGeometry(); + else if (m_series->useOpenGL() && visibleChanged) + refreshGlChart(); update(); } diff --git a/src/charts/scatterchart/scatterchartitem.cpp b/src/charts/scatterchart/scatterchartitem.cpp index cc1ecb60..df31b7d7 100644 --- a/src/charts/scatterchart/scatterchartitem.cpp +++ b/src/charts/scatterchart/scatterchartitem.cpp @@ -256,15 +256,21 @@ void ScatterChartItem::setBrush(const QBrush &brush) void ScatterChartItem::handleUpdated() { - int count = m_items.childItems().count(); + if (m_series->useOpenGL()) { + if ((m_series->isVisible() != m_visible)) { + m_visible = m_series->isVisible(); + refreshGlChart(); + } + return; + } + int count = m_items.childItems().count(); if (count == 0) return; bool recreate = m_visible != m_series->isVisible() || m_size != m_series->markerSize() || m_shape != m_series->markerShape(); - m_visible = m_series->isVisible(); m_size = m_series->markerSize(); m_shape = m_series->markerShape(); diff --git a/src/charts/xychart/glxyseriesdata.cpp b/src/charts/xychart/glxyseriesdata.cpp index 37da55b1..9a6f330a 100644 --- a/src/charts/xychart/glxyseriesdata.cpp +++ b/src/charts/xychart/glxyseriesdata.cpp @@ -50,6 +50,7 @@ void GLXYSeriesDataManager::setPoints(QXYSeries *series, const AbstractDomain *d if (!data) { data = new GLXYSeriesData; data->type = series->type(); + data->visible = series->isVisible(); QColor sc; if (data->type == QAbstractSeries::SeriesTypeScatter) { QScatterSeries *scatter = static_cast<QScatterSeries *>(series); @@ -68,6 +69,8 @@ void GLXYSeriesDataManager::setPoints(QXYSeries *series, const AbstractDomain *d data->color = QVector3D(float(sc.redF()), float(sc.greenF()), float(sc.blueF())); connect(series, &QXYSeries::useOpenGLChanged, this, &GLXYSeriesDataManager::handleSeriesOpenGLChange); + connect(series, &QXYSeries::visibleChanged, this, + &GLXYSeriesDataManager::handleSeriesVisibilityChange); m_seriesDataMap.insert(series, data); m_mapDirty = true; } @@ -174,6 +177,18 @@ void GLXYSeriesDataManager::handleSeriesOpenGLChange() removeSeries(series); } +void GLXYSeriesDataManager::handleSeriesVisibilityChange() +{ + QXYSeries *series = qobject_cast<QXYSeries *>(sender()); + if (series) { + GLXYSeriesData *data = m_seriesDataMap.value(series); + if (data) { + data->visible = series->isVisible(); + data->dirty = true; + } + } +} + void GLXYSeriesDataManager::handleScatterColorChange() { QScatterSeries *series = qobject_cast<QScatterSeries *>(sender()); diff --git a/src/charts/xychart/glxyseriesdata_p.h b/src/charts/xychart/glxyseriesdata_p.h index 578ab217..4a22e575 100644 --- a/src/charts/xychart/glxyseriesdata_p.h +++ b/src/charts/xychart/glxyseriesdata_p.h @@ -58,6 +58,7 @@ struct GLXYSeriesData { QAbstractSeries::SeriesType type; QVector2D min; QVector2D delta; + bool visible; QMatrix4x4 matrix; public: GLXYSeriesData &operator=(const GLXYSeriesData &data) { @@ -68,6 +69,7 @@ public: type = data.type; min = data.min; delta = data.delta; + visible = data.visible; matrix = data.matrix; return *this; } @@ -103,6 +105,7 @@ public Q_SLOTS: void cleanup(); void handleSeriesPenChange(); void handleSeriesOpenGLChange(); + void handleSeriesVisibilityChange(); void handleScatterColorChange(); void handleScatterMarkerSizeChange(); diff --git a/src/charts/xychart/qvxymodelmapper.cpp b/src/charts/xychart/qvxymodelmapper.cpp index fb7f63ab..3b68d809 100644 --- a/src/charts/xychart/qvxymodelmapper.cpp +++ b/src/charts/xychart/qvxymodelmapper.cpp @@ -120,7 +120,7 @@ QT_CHARTS_BEGIN_NAMESPACE Minimal and default value is: -1 (count limited by the number of rows in the model) */ /*! - \qmlproperty int VXYModelMapper::columnCount + \qmlproperty int VXYModelMapper::rowCount Defines the number of rows of the model that are mapped as the data for series. The default value is -1 (count limited by the number of rows in the model). */ diff --git a/src/charts/xychart/qxymodelmapper.cpp b/src/charts/xychart/qxymodelmapper.cpp index b6037858..3b2ccd83 100644 --- a/src/charts/xychart/qxymodelmapper.cpp +++ b/src/charts/xychart/qxymodelmapper.cpp @@ -32,6 +32,7 @@ #include <QtCharts/QXYSeries> #include <QtCore/QAbstractItemModel> #include <QtCore/QDateTime> +#include <QtCore/QDebug> QT_CHARTS_BEGIN_NAMESPACE @@ -544,15 +545,27 @@ void QXYModelMapperPrivate::initializeXYFromModel() int pointPos = 0; QModelIndex xIndex = xModelIndex(pointPos); QModelIndex yIndex = yModelIndex(pointPos); - while (xIndex.isValid() && yIndex.isValid()) { - QPointF point; - point.setX(valueFromModel(xIndex)); - point.setY(valueFromModel(yIndex)); - m_series->append(point); - pointPos++; - xIndex = xModelIndex(pointPos); - yIndex = yModelIndex(pointPos); + + if (xIndex.isValid() && yIndex.isValid()) { + while (xIndex.isValid() && yIndex.isValid()) { + QPointF point; + point.setX(valueFromModel(xIndex)); + point.setY(valueFromModel(yIndex)); + m_series->append(point); + pointPos++; + xIndex = xModelIndex(pointPos); + yIndex = yModelIndex(pointPos); + // Don't warn about invalid index after the first, those are valid and used to + // determine when we should end looping. + } + } else { + // Invalid index right off the bat means series will be left empty, so output a warning + if (!xIndex.isValid()) + qWarning() << __FUNCTION__ << QStringLiteral("Invalid X coordinate index in model mapper."); + else if (!yIndex.isValid()) + qWarning() << __FUNCTION__ << QStringLiteral("Invalid Y coordinate index in model mapper."); } + blockSeriesSignals(false); } diff --git a/src/charts/xychart/xychart.cpp b/src/charts/xychart/xychart.cpp index 28553d55..7493ea43 100644 --- a/src/charts/xychart/xychart.cpp +++ b/src/charts/xychart/xychart.cpp @@ -126,6 +126,12 @@ void XYChart::updateGlChart() updateGeometry(); } +// Doesn't update gl geometry, but refreshes the chart +void XYChart::refreshGlChart() +{ + presenter()->updateGLWidget(); +} + //handlers void XYChart::handlePointAdded(int index) diff --git a/src/charts/xychart/xychart_p.h b/src/charts/xychart/xychart_p.h index c0348c18..c5737cca 100644 --- a/src/charts/xychart/xychart_p.h +++ b/src/charts/xychart/xychart_p.h @@ -88,6 +88,7 @@ Q_SIGNALS: protected: virtual void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index = -1); virtual void updateGlChart(); + virtual void refreshGlChart(); private: inline bool isEmpty(); diff --git a/src/chartsqml2/declarativebarseries.cpp b/src/chartsqml2/declarativebarseries.cpp index 70fbcf36..d335f9d5 100644 --- a/src/chartsqml2/declarativebarseries.cpp +++ b/src/chartsqml2/declarativebarseries.cpp @@ -87,12 +87,12 @@ void DeclarativeBarSet::setValues(QVariantList values) } } - QVector<int> indexValueList; + QVector<qreal> indexValueList; indexValueList.resize(maxValue + 1); for (int i = 0; i < values.count(); i++) { if (values.at(i).canConvert(QVariant::Point)) { - indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y()); + indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPointF().y()); } } diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp index ec5e83a0..13f01123 100644 --- a/src/chartsqml2/declarativechart.cpp +++ b/src/chartsqml2/declarativechart.cpp @@ -524,13 +524,18 @@ QSGNode *DeclarativeChart::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdateP connect(window(), &QQuickWindow::beforeRendering, node->glRenderNode(), &DeclarativeRenderNode::render); } + // Ensure that chart is rendered whenever node is recreated + if (m_sceneImage) + m_sceneImageDirty = true; } const QRectF &bRect = boundingRect(); // Update GL data if (node->glRenderNode() && (m_glXYDataManager->dataMap().size() || m_glXYDataManager->mapDirty())) { - const QRectF &plotArea = m_chart->plotArea(); + // Convert plotArea to QRect and back to QRectF to get rid of sub-pixel widths/heights + // which can cause unwanted partial antialising of the graph. + const QRectF plotArea = QRectF(m_chart->plotArea().toRect()); const QSizeF &chartAreaSize = m_chart->size(); // We can't use chart's plot area directly, as graphicscene has some internal minimum size diff --git a/src/chartsqml2/declarativerendernode.cpp b/src/chartsqml2/declarativerendernode.cpp index c11f6b00..71d582cc 100644 --- a/src/chartsqml2/declarativerendernode.cpp +++ b/src/chartsqml2/declarativerendernode.cpp @@ -232,31 +232,33 @@ void DeclarativeRenderNode::renderGL() QOpenGLBuffer *vbo = m_seriesBufferMap.value(i.key()); GLXYSeriesData *data = i.value(); - m_program->setUniformValue(m_colorUniformLoc, data->color); - m_program->setUniformValue(m_minUniformLoc, data->min); - m_program->setUniformValue(m_deltaUniformLoc, data->delta); - m_program->setUniformValue(m_matrixUniformLoc, data->matrix); - - if (!vbo) { - vbo = new QOpenGLBuffer; - m_seriesBufferMap.insert(i.key(), vbo); - vbo->create(); - } - vbo->bind(); - if (data->dirty) { - vbo->allocate(data->array.constData(), data->array.count() * sizeof(GLfloat)); - data->dirty = false; - } + if (data->visible) { + m_program->setUniformValue(m_colorUniformLoc, data->color); + m_program->setUniformValue(m_minUniformLoc, data->min); + m_program->setUniformValue(m_deltaUniformLoc, data->delta); + m_program->setUniformValue(m_matrixUniformLoc, data->matrix); + + if (!vbo) { + vbo = new QOpenGLBuffer; + m_seriesBufferMap.insert(i.key(), vbo); + vbo->create(); + } + vbo->bind(); + if (data->dirty) { + vbo->allocate(data->array.constData(), data->array.count() * sizeof(GLfloat)); + data->dirty = false; + } - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); - if (data->type == QAbstractSeries::SeriesTypeLine) { - glLineWidth(data->width); - glDrawArrays(GL_LINE_STRIP, 0, data->array.size() / 2); - } else { // Scatter - m_program->setUniformValue(m_pointSizeUniformLoc, data->width); - glDrawArrays(GL_POINTS, 0, data->array.size() / 2); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); + if (data->type == QAbstractSeries::SeriesTypeLine) { + glLineWidth(data->width); + glDrawArrays(GL_LINE_STRIP, 0, data->array.size() / 2); + } else { // Scatter + m_program->setUniformValue(m_pointSizeUniformLoc, data->width); + glDrawArrays(GL_POINTS, 0, data->array.size() / 2); + } + vbo->release(); } - vbo->release(); } #ifdef QDEBUG_TRACE_GL_FPS |