-------------------------------------------------

笔记:

QML 各个Element对应的c++类(http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeelements.html):

Item instantiates the C++ class QDeclarativeItem

Component instantiates the C++ class QDeclarativeComponent

QtObject instantiates the C++ class QObject

 

 

要点:

PieChart::PieChart(QDeclarativeItem *parent) :

QDeclarativeItem(parent)
{
// need to disable this flag to draw inside a QDeclarativeItem
setFlag(QGraphicsItem::ItemHasNoContents, false);
}


 

qmlRegisterType<PieChart>("com.mycompany.Charts", 1, 0, "PieChart");


 

import com.mycompany.Charts 1.0