How to remove extra margins arounding a QPixmap?



  • I draw a QRectF in the paint function of my class and set a QPixmap as brush for it. I build an object from a class containing this QRectF. When I put this item in my scene and set background for the scene the QRectF appears. It also occurs for a QPixmap that I add to the scene. What can I do to remove the extra margins?
    @
    void MyQgraphicsObject::paint(QPainter *painter, )
    {
    QRectF rec(0,0,50,60);
    QPixmap pi(":picture/im/super.jpg");
    pi=pi.scaled(50,60);
    painter->setBrush(QBrush(pi));
    painter->setPen(Qt::NoPen);
    painter->drawRoundedRect(rec,10,10);
    }
    ////////////////////
    QPixmap a(":picture/im/cloud.jpg");
    scene->addPixmap(a);
    scene->setbackground(Qt::blue);@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.