I am working on an application where I need to fill the color for the Pixmap using Painter. Pixmap is of type rectangle with (bottom edge) 2 rounded corners. Top 2 corners a
To extend the answer of Romha Korev. Here an example of a box with only rounded top corners (top left, top right). The rectangles in the corners are calculated based on the main rectangle!
qreal left = 5;
qreal top = 10;
qreal width = 100;
qreal height = 20;
QRectF rect(left, top, width, height);
QPainterPath path;
path.setFillRule( Qt::WindingFill );
path.addRoundedRect(rect, 5, 5 );
qreal squareSize = height/2;
path.addRect( QRect( left, top+height-squareSize, squareSize, squareSize) ); // Bottom left
path.addRect( QRect( (left+width)-squareSize, top+height-squareSize, squareSize, squareSize) ); // Bottom right
painter->drawPath( path.simplified() ); // Draw box (only rounded at top)