i want to set a QPixmap
as brush for a rectangle in paint
method .I do this work but it doesn't set accurately .I test many value for width and height but yet it wasn't good .Overall, what sizes should I set for the rectangle surrounding the photo that put in it properly?
void set_coin::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,)
{
QRectF rec(x_size,y_size,10,30);
QPixmap coin(":pictures/image/coin.jpg");
coin=coin.scaled(10,30);
painter->setBrush(QBrush(coin));
painter->setPen(Qt::NoPen);
//painter->drawRect(rec);
painter->drawRoundedRect(rec,10,10);
}
QRectF set_coin::boundingRect() const
{
return QRectF(x_size-10,y_size-10,20,40);
}