我继承自QGraphicsPolygonItem,并想在项目的顶部绘制一个QPixmap。项目本身和像素图应该用圆角绘制。
你怎么会这样?
答案 0 :(得分:4)
如果你想用圆角绘制QPixmap,那么在paint事件中从QPixmap创建QBrush并将其应用于画家:
painter->setRenderHint(QPainter::Antialiasing, true);
QBrush brush = QBrush(pixmap);
painter->setBrush(brush);
painter->drawRoundedRect(polygon().boundingRect(), 5, 5);