diff options
author | Michal Klocek <michal.klocek@qt.io> | 2018-04-24 12:32:17 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2018-04-30 13:59:23 +0000 |
commit | d3ea72e28ca82640e50900d42bf0c9ee76aa7f95 (patch) | |
tree | 1d72276672b2ef7b1ac76e77283f31d45530cb3c /examples/charts/temperaturerecords/main.cpp | |
parent | 8b4ad5a108b53e6964815856b37cf004099ce505 (diff) |
Add proper 'deprecated' warnings
Use Q_DECL_DEPRECATED to mark deprecated API. Fix examples to do
not use deprecated functions.
These functions were 'marked' as deprecated when multiple axes
were introduced. Moreover, axis X/Y is an ambiguous term and not necessary
mean Horizontal/Vertical axis. These deprecated methods also create an
issue when given series should be attached to several Horizonal/
Vertical axes and calling them can cause unwanted results.
Change-Id: I639e1b964240b80c2b3b93b74b061da324bca1ff
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples/charts/temperaturerecords/main.cpp')
-rw-r--r-- | examples/charts/temperaturerecords/main.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/charts/temperaturerecords/main.cpp b/examples/charts/temperaturerecords/main.cpp index b521dee7..92508b58 100644 --- a/examples/charts/temperaturerecords/main.cpp +++ b/examples/charts/temperaturerecords/main.cpp @@ -35,6 +35,7 @@ #include <QtCharts/QLegend> #include <QtCharts/QBarCategoryAxis> #include <QtCharts/QStackedBarSeries> +#include <QtCharts/QValueAxis> QT_CHARTS_USE_NAMESPACE @@ -70,13 +71,16 @@ int main(int argc, char *argv[]) "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - QBarCategoryAxis *axis = new QBarCategoryAxis(); - axis->append(categories); - axis->setTitleText("Month"); - chart->createDefaultAxes(); - chart->setAxisX(axis, series); - chart->axisY(series)->setRange(-52, 52); - chart->axisY(series)->setTitleText("Temperature [°C]"); + QBarCategoryAxis *axisX = new QBarCategoryAxis(); + axisX->append(categories); + axisX->setTitleText("Month"); + chart->addAxis(axisX, Qt::AlignBottom); + QValueAxis *axisY = new QValueAxis(); + axisY->setRange(-52, 52); + axisY->setTitleText("Temperature [°C]"); + chart->addAxis(axisY, Qt::AlignLeft); + series->attachAxis(axisX); + series->attachAxis(axisY); //![4] //![5] |