2014-12-05 61 views
1

我寫了一個示例代碼:使用的drawRect與QQuickPaintedItem :: paint()方法

class Element : public QQuickPaintedItem 
{ 
    void paint(QPainter *painter) 
    { 
     painter->setBrush(Qt::blue); 
     painter->drawRect(contentsBoundingRect()); 
    } 
} 

和QML:

Element {  
    x : 19 
    y : 37 
    width : 371 
    height : 201 
} 

左側邊緣和頂部邊緣都很好,但右邊緣底部邊緣消失!

我犯了一些錯誤嗎?

PS:我用QT5.3在WIN XP

回答