Hi!
I would create only one custom QGraphicsItem per page. In it's paintEvent you can draw everything on a QPainter just like you do when printing:
Sorry - code is cpp; can you translate that?
public:
Page() {}
// You need to change that!
{
painter->drawRect(boundingRect());
....
painter->setFont(..)
painter->drawText(..)
}
};
Page* page = new Page();
// set the content..
scene->addItem(page);
class Page : public QGraphicsItem {
public:
Page() {}
// You need to change that!
QRectF boundingRect() const{ return QRectF(0, 0, 50, 50); }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget)
{
painter->drawRect(boundingRect());
....
painter->setFont(..)
painter->drawText(..)
}
};
Page* page = new Page();
// set the content..
scene->addItem(page);
To copy to clipboard, switch view to plain text mode
HIH
Johannes
Bookmarks