I did not find that changing the bounding rect was needed.
{
public:
MyGraphicsPixmapItem
(const QPixmap
& pixmap,
QGraphicsItem* parent
= 0) : {
painter->translate(-(option->rect.width() / 2), -(option->rect.height() / 2));
}
};
class MyGraphicsPixmapItem : public QGraphicsPixmapItem
{
public:
MyGraphicsPixmapItem(const QPixmap& pixmap, QGraphicsItem* parent = 0) :
QGraphicsPixmapItem(pixmap, parent) {};
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
painter->translate(-(option->rect.width() / 2), -(option->rect.height() / 2));
QGraphicsPixmapItem::paint(painter, option, widget);
}
};
To copy to clipboard, switch view to plain text mode
This is all I had to do. Did I miss anything? Thank you for your direction.
Bookmarks