[Okular-devel] Generic Generator for QTextDocument

Tobias Koenig tokoe at kde.org
Thu Jan 11 01:13:36 CET 2007

On Wed, Jan 10, 2007 at 10:36:00PM +0100, Albert Astals Cid wrote:
> A Dimecres 10 Gener 2007 17:54, Tobias Koenig va escriure:
Hi Albert,

> > and implementing the 'convert' method in MyConverter.
> Seems good :-)
> Just have a question, 'convert' methid is only be called once in the whole 
> lifetime and Okular::GenericGenerator caches everything from there?
Yes, that's a problem of the document design. In opposite of PDF where
you know exactly which elements will be on which page that's not the
case for ODT and FictionBook. There you has just one large canvas which
is split into the single pages by defining a page size after the
layouting is done. So to get a single page you always have to layout the
whole document... I know that sucks, but that's how stupid word
processors are designed.

Surprisingly even large documents load quite fast with QTextDocument
from Qt 4.2.2 and I expect further improvements for Qt 4.3 when we can
move the rendering into its own thread (FontRendering will be possible
without X11 connection then).

> > One issue that crossed my plans you can see in addLink( Link*, int, int ).
> > I want to pass the Link object here, so the developer can choose what
> > type of link he wants to use in the Converter. However the passed object
> > is use for an object rect which is deleted at every pixmapRequest, so
> > passing the link here once doesn't work, because a new object is needed
> > for every pixmapRequest.
> I see two [ugly] solutions:
>  - Keep a Link * on the Okular::GenericGenerator and always return a copy of 
> it so when ~ObjectRect() happens the deleted one is not the original, ugly 
> because you end up using more memory than needed
If we think about how many links are used in a document in opposite to
TextPageEntities, that shouldn't be a big problem. However we have to
implement Link( const Link& other ) and operator=( const Link& other )
then, because it's Q_DISABLE_COPY atm. If that's fine with you I'll
implement it.

>  - Add a LinkNotDeleteMe entry to the ObjectType enum of ObjectRect that is 
> equivalent to Link except that the link * is not deleted on ~ObjectRect. Ugly 
> because it smells like a hack to me.
Yeah, that's really ugly ;)

Separate politics from religion and economy!
The Council of the European Union is an undemocratic and illegal institution!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.kde.org/pipermail/okular-devel/attachments/20070111/bccf0006/attachment.pgp 

More information about the Okular-devel mailing list