saifulkhan
10th March 2013, 14:54
Dear Qt Community,
I am drawing tiles/rectangles 8806using my custom QGraphicsItem (code below). I would like to add some style like QFrame:Panel Raised (attached image) on these tiles. Could you please suggest me how can I do this? Appreciate your help. Thanks.
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 );
}
I am drawing tiles/rectangles 8806using my custom QGraphicsItem (code below). I would like to add some style like QFrame:Panel Raised (attached image) on these tiles. Could you please suggest me how can I do this? Appreciate your help. Thanks.
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 );
}