Chapter 2: Connecting to C++ Methods and Signals

Qt slot  或者 using Q_INVOKABLE 都可以被qml调用

 

 public:
     ...
     Q_INVOKABLE void clearChart();

 signals:
     void chartCleared();

 

qml中对应onChartCleared

 

Chapter 3: Adding Property Bindings

allows values of different elements to be synchronized automatically

让不同元素的值自动同步

The "color: chartA.color" statement binds the color value of chartB to the color of chartA

 class PieChart : public QDeclarativeItem
 {
     ...
     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
 public:
     ...
 signals:
     void colorChanged();
     ...
 };

posted on 2011-11-03 17:05  katago  阅读(177)  评论(0编辑  收藏  举报