您能否告诉我如何通过自定义 QGraphicsItem绘制具有这样边界的矩形。我做了布局并绘制了矩形,但我的矩形的边界是普通的笔。请求您的帮助。谢谢。
void QGraphicsTileItem::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
/// Draw the rect
painter->setRenderHints( QPainter::Antialiasing |
QPainter::TextAntialiasing |
QPainter::SmoothPixmapTransform |
QPainter::HighQualityAntialiasing, true );
painter->setPen( pen );
painter->setBrush( colour );
painter->drawRect( bound );
painter->drawText( bound, Qt::AlignLeft | Qt::AlignTop |
Qt::TextSingleLine, name );
}