I try to (draw) in split mode a QTextDocument on each page to edit text & display pages, (like openoffice)
the spitt is only a QGraphicsItem paint after i retranslate
all keybord / mouse event to correct QPointF, only to textapi.
But i can not controll the cutting blockelement ...
the page 1 & 2 is ok after the cutting paint go crazy.
I suppose i must write a QPaintEngine like QTextDocument[::]print() and PageBreakFlags must run i suppose ?
Or is here other way?
How i subclass QPaintEngine to binding to QGraphicsItem[::]paint() ?
and respect PageBreakFlags policy...
/* M_PageSize DDPAGE; = container
from margin and multi page size */
{
const QRectF rectalldoc
= boundingRect
();
/* all page rect call to recalc pagetotal */ const int PageS = DocPageSumme;
for (int i = 0; i < PageS; ++i) {
painter->save();
const QRectF innrect
= DDPAGE.
PageInternal(i
);
/* rect to place one page */ painter->translate(innrect.topLeft().x(), innrect.topLeft().y() - (i * DDPAGE.hight()) );
_d
->drawContents
(painter,
QRectF(0, i
* DDPAGE.
hight() ,_d
->size
().
rwidth(), DDPAGE.
hight() ));
painter->restore();
}
}
/* M_PageSize DDPAGE; = container
from margin and multi page size */
void BaseText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
const QRectF rectalldoc = boundingRect(); /* all page rect call to recalc pagetotal */
const int PageS = DocPageSumme;
QTextDocument *_d = document();
for (int i = 0; i < PageS; ++i) {
painter->save();
const QRectF innrect = DDPAGE.PageInternal(i); /* rect to place one page */
painter->translate(innrect.topLeft().x(), innrect.topLeft().y() - (i * DDPAGE.hight()) );
_d->drawContents(painter,QRectF(0, i * DDPAGE.hight() ,_d->size().rwidth(), DDPAGE.hight() ));
painter->restore();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks