Update extension tutorials and examples to QtQuick2
[profile/ivi/qtdeclarative.git] / examples / declarative / tutorials / extending / chapter6-plugins / pieslice.cpp
index 16f4bae..70338f0 100644 (file)
 
 #include <QPainter>
 
-PieSlice::PieSlice(QDeclarativeItem *parent)
-    : QDeclarativeItem(parent)
+PieSlice::PieSlice(QSGItem *parent)
+    : QSGPaintedItem(parent)
 {
-    // need to disable this flag to draw inside a QDeclarativeItem
-    setFlag(QGraphicsItem::ItemHasNoContents, false);
 }
 
 QColor PieSlice::color() const
@@ -78,11 +76,11 @@ void PieSlice::setAngleSpan(int angle)
     m_angleSpan = angle;
 }
 
-void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieSlice::paint(QPainter *painter)
 {
     QPen pen(m_color, 2);
     painter->setPen(pen);
-    painter->setRenderHints(QPainter::Antialiasing, true);
+    painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
     painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
 }