##// END OF EJS Templates
Improve QML Weather example layout...
Improve QML Weather example layout The size of the images is adjusted based on the window size. Change-Id: Ib575288456d6773e00ee740b7b0be6a392c9eeaa Task-number: QTRD-3444 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2740:377e4516d036
r2761:c19e8d5c88d9
Show More
main.cpp
111 lines | 3.8 KiB | text/x-c | CppLexer
Jani Honkonen
Add/modify license headers
r830 /****************************************************************************
**
Titta Heikkala
Update copyright year...
r2688 ** Copyright (C) 2014 Digia Plc
Jani Honkonen
Add/modify license headers
r830 ** All rights reserved.
Titta Heikkala
Updated license headers...
r2740 ** For any questions to Digia, please use contact form at http://qt.io
Jani Honkonen
Add/modify license headers
r830 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Jani Honkonen
Add/modify license headers
r830 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
** agreement between you and Digia.
Jani Honkonen
Add/modify license headers
r830 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Jani Honkonen
Add/modify license headers
r830 **
****************************************************************************/
Titta Heikkala
Fix include syntax...
r2714 #include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtCharts/QChartView>
#include <QtCharts/QBarSet>
#include <QtCharts/QLegend>
sauimone
splitted barchartdrilldown example to separate files
r903 #include "drilldownseries.h"
#include "drilldownchart.h"
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_USE_NAMESPACE
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
sauimone
stacked bar drilldown example documentation update
r1415 //! [1]
Jani Honkonen
more coding style fixes for examples...
r2102 DrilldownChart *drilldownChart = new DrilldownChart();
Jani Honkonen
Make stackedbarchartdrilldown compile
r829 drilldownChart->setTheme(QChart::ChartThemeBlueIcy);
drilldownChart->setAnimationOptions(QChart::SeriesAnimations);
sauimone
stacked bar drilldown example documentation update
r1415 //! [1]
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
sauimone
stacked bar drilldown example documentation update
r1415 //! [2]
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425 // Define categories
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430 QStringList months;
sauimone
Documentation for stacked barchart drilldown example
r462 months << "May" << "Jun" << "Jul" << "Aug" << "Sep";
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430 QStringList weeks;
weeks << "week 1" << "week 2" << "week 3" << "week 4";
QStringList plants;
plants << "Habanero" << "Lemon Drop" << "Starfish" << "Aji Amarillo";
sauimone
stacked bar drilldown example documentation update
r1415 //! [2]
sauimone
Drilldown example using stacked barchart.
r449
sauimone
stacked bar drilldown example documentation update
r1415 //! [3]
sauimone
Drilldown example using stacked barchart.
r449 // Create drilldown structure
Jani Honkonen
more coding style fixes for examples...
r2102 DrilldownBarSeries *seasonSeries = new DrilldownBarSeries(months, drilldownChart);
Tero Ahola
Fixed build error caused by QSeries name change
r733 seasonSeries->setName("Crop by month - Season");
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425
sauimone
Drilldown example using stacked barchart.
r449 // Each month in season series has drilldown series for weekly data
Jani Honkonen
coding style fixes for examples
r2098 for (int month = 0; month < months.count(); month++) {
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
sauimone
Drilldown example using stacked barchart.
r449 // Create drilldown series for every week
Jani Honkonen
more coding style fixes for examples...
r2102 DrilldownBarSeries *weeklySeries = new DrilldownBarSeries(weeks, drilldownChart);
sauimone
Documentation for stacked barchart drilldown example
r462 seasonSeries->mapDrilldownSeries(month, weeklySeries);
sauimone
updating drilldown example. Needs some more thinking
r438
sauimone
Drilldown example using stacked barchart.
r449 // Drilling down from weekly data brings us back to season data.
Jani Honkonen
coding style fixes for examples
r2098 for (int week = 0; week < weeks.count(); week++) {
sauimone
Documentation for stacked barchart drilldown example
r462 weeklySeries->mapDrilldownSeries(week, seasonSeries);
sauimone
removed categories from barseries. categories are now only on axis
r1321 weeklySeries->setName(QString("Crop by week - " + months.at(month)));
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430 }
sauimone
removed double signal emitting from barseries/set
r1563 // Use clicked signal to implement drilldown
Jani Honkonen
normalize signal/slot signatures
r2110 QObject::connect(weeklySeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430 }
sauimone
Documentation for stacked barchart drilldown example
r462
sauimone
removed double signal emitting from barseries/set
r1563 // Enable drilldown from season series using clicked signal
Jani Honkonen
normalize signal/slot signatures
r2110 QObject::connect(seasonSeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
sauimone
stacked bar drilldown example documentation update
r1415 //! [3]
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
sauimone
stacked bar drilldown example documentation update
r1415 //! [4]
sauimone
Drilldown example using stacked barchart.
r449 // Fill monthly and weekly series with data
sauimone
updating drilldown example. Needs some more thinking
r438 foreach (QString plant, plants) {
Jani Honkonen
more coding style fixes for examples...
r2102 QBarSet *monthlyCrop = new QBarSet(plant);
Jani Honkonen
coding style fixes for examples
r2098 for (int month = 0; month < months.count(); month++) {
Jani Honkonen
more coding style fixes for examples...
r2102 QBarSet *weeklyCrop = new QBarSet(plant);
Jani Honkonen
coding style fixes for examples
r2098 for (int week = 0; week < weeks.count(); week++)
sauimone
updating drilldown example. Needs some more thinking
r438 *weeklyCrop << (qrand() % 20);
sauimone
Documentation for stacked barchart drilldown example
r462 // Get the drilldown series from season series and add crop to it.
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 seasonSeries->drilldownSeries(month)->append(weeklyCrop);
sauimone
barchart pimpl part 1
r934 *monthlyCrop << weeklyCrop->sum();
sauimone
updating drilldown example. Needs some more thinking
r438 }
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 seasonSeries->append(monthlyCrop);
sauimone
updating drilldown example. Needs some more thinking
r438 }
sauimone
stacked bar drilldown example documentation update
r1415 //! [4]
sauimone
Drilldown example using stacked barchart.
r449
sauimone
stacked bar drilldown example documentation update
r1415 //! [5]
sauimone
Drilldown example using stacked barchart.
r449 // Show season series in initial view
drilldownChart->changeSeries(seasonSeries);
Jani Honkonen
Make stackedbarchartdrilldown compile
r829 drilldownChart->setTitle(seasonSeries->name());
sauimone
stacked bar drilldown example documentation update
r1415 //! [5]
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
sauimone
stacked bar drilldown example documentation update
r1415 //! [6]
Michal Klocek
Renames Grid to GridLine
r535 drilldownChart->axisX()->setGridLineVisible(false);
sauimone
turned legend on in barchart examples
r891 drilldownChart->legend()->setVisible(true);
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 drilldownChart->legend()->setAlignment(Qt::AlignBottom);
sauimone
stacked bar drilldown example documentation update
r1415 //! [6]
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
Jani Honkonen
Make stackedbarchartdrilldown compile
r829 QChartView *chartView = new QChartView(drilldownChart);
window.setCentralWidget(chartView);
Titta Heikkala
Fix the geometry for examples and demos...
r2647 window.resize(480, 300);
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425 window.show();
sauimone
Drilldown example for barcharts continuing. Still some bugs
r430
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425 return a.exec();
}