##// END OF EJS Templates
Moves charts to separate directories in chartviewer
Moves charts to separate directories in chartviewer

File last commit:

r1842:8212e3091e6d
r1892:d1952fe8fcb0
Show More
main.cpp
70 lines | 1.8 KiB | text/x-c | CppLexer
Michal Klocek
Uninfy examples , updated public API changes
r747 /****************************************************************************
Jani Honkonen
Add/modify license headers
r830 **
** Copyright (C) 2012 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 Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial 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
** $QT_END_LICENSE$
**
****************************************************************************/
Michal Klocek
Uninfy examples , updated public API changes
r747
#include <QApplication>
Jani Honkonen
Added piechart example
r128 #include <QMainWindow>
Michal Klocek
Uninfy examples , updated public API changes
r747 #include <QChartView>
#include <QPieSeries>
#include <QPieSlice>
Jani Honkonen
Added piechart example
r128
QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Michal Klocek
Uninfy examples , updated public API changes
r747 //![1]
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 QPieSeries *series = new QPieSeries();
Jani Honkonen
pie: change the order of parameters when creating slices to be more intuitive
r1206 series->append("Jane", 1);
series->append("Joe", 2);
series->append("Andy", 3);
series->append("Barbara", 4);
series->append("Axel", 5);
Michal Klocek
Uninfy examples , updated public API changes
r747 //![1]
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203
Michal Klocek
Uninfy examples , updated public API changes
r747 //![2]
Jani Honkonen
Improving pie examples
r892 QPieSlice *slice = series->slices().at(1);
Jani Honkonen
Add custom slice color & explode & visible label in basic piechart example.
r713 slice->setExploded();
slice->setLabelVisible();
Jani Honkonen
remove "slice" word from pen/brush setters/getters
r756 slice->setPen(QPen(Qt::darkGreen, 2));
slice->setBrush(Qt::green);
Michal Klocek
Uninfy examples , updated public API changes
r747 //![2]
Jani Honkonen
Pie doc updates
r880
Michal Klocek
Uninfy examples , updated public API changes
r747 //![3]
QChart* chart = new QChart();
chart->addSeries(series);
chart->setTitle("Simple piechart example");
Marek Rosa
Added simple donut chart example docs
r1842 chart->legend()->hide();
Michal Klocek
Uninfy examples , updated public API changes
r747 //![3]
Jani Honkonen
Pie doc updates
r880
Michal Klocek
Uninfy examples , updated public API changes
r747 //![4]
QChartView* chartView = new QChartView(chart);
chartView->setRenderHint(QPainter::Antialiasing);
//![4]
Jani Honkonen
Pie doc updates
r880
Michal Klocek
Uninfy examples , updated public API changes
r747 //![5]
QMainWindow window;
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 window.setCentralWidget(chartView);
Michal Klocek
Uninfy examples , updated public API changes
r747 window.resize(400, 300);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 window.show();
Michal Klocek
Uninfy examples , updated public API changes
r747 //![5]
Jani Honkonen
Pie doc updates
r880
Jani Honkonen
Added piechart example
r128 return a.exec();
}