aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp')
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
index bfc1645f57..5820c5626c 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
@@ -41,11 +41,9 @@
#include <QPainter>
//![0]
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
//![0]
@@ -70,11 +68,11 @@ void PieChart::setColor(const QColor &color)
}
//![1]
-void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieChart::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
}
//![1]