Update extension tutorials and examples to QtQuick2
[profile/ivi/qtdeclarative.git] / examples / declarative / tutorials / extending / chapter4-customPropertyTypes / pieslice.cpp
index f36c8ce..764ef23 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
@@ -58,11 +56,11 @@ void PieSlice::setColor(const QColor &color)
     m_color = color;
 }
 
-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(), 90 * 16, 290 * 16);
 }