From 964c794fe6130d523e1bf0fc565ca4a4a3b09252 2012-03-23 13:30:51 From: Jani Honkonen Date: 2012-03-23 13:30:51 Subject: [PATCH] Add custom slice color & explode & visible label in basic piechart example. --- diff --git a/examples/piechart/main.cpp b/examples/piechart/main.cpp index d33c198..fbc97b1 100644 --- a/examples/piechart/main.cpp +++ b/examples/piechart/main.cpp @@ -14,6 +14,8 @@ int main(int argc, char *argv[]) QMainWindow window; QChartView* chartView = new QChartView(&window); + chartView->setRenderHint(QPainter::Antialiasing); + chartView->setChartTitle("Simple pie chart"); //! [1] QPieSeries *series = new QPieSeries(); @@ -22,9 +24,18 @@ int main(int argc, char *argv[]) series->add(3, "Slice 3"); series->add(4, "Slice 4"); series->add(5, "Slice 5"); - chartView->addSeries(series); //! [1] + //! [2] + QPieSlice *slice = series->slices().first(); + slice->setExploded(); + slice->setLabelVisible(); + slice->setSlicePen(QPen(Qt::darkGreen, 2)); + slice->setSliceBrush(Qt::green); + //! [2] + + chartView->addSeries(series); + window.setCentralWidget(chartView); window.resize(600, 600); window.show();