{
public:
//SimpleItem(QString Title);
{
qreal penWidth = 1;
return QRectF(-10 - penWidth
/ 2,
-10 - penWidth
/ 2,
20 + penWidth, 20 + penWidth);
}
{
painter->drawRoundedRect(-10, -10, 100, 50, 5, 5);
//painter->brush(Qt::blue);
//QVariant title = title;
painter->drawText(10, 10, "Title");
painter->drawText(10, 30, "Subtitle");
}
};
class SimpleItem : public QGraphicsItem
{
public:
//SimpleItem(QString Title);
QRectF boundingRect() const
{
qreal penWidth = 1;
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
20 + penWidth, 20 + penWidth);
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
painter->drawRoundedRect(-10, -10, 100, 50, 5, 5);
//painter->brush(Qt::blue);
//QVariant title = title;
painter->drawText(10, 10, "Title");
painter->drawText(10, 30, "Subtitle");
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks