Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?

C++
<pre
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);
Posted
Updated 29-Jun-14 7:52am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900