[Qt-interest] QTextDocumentLayout patch? OR modifying private classes?

Josh jnfo-c at grauman.com
Mon May 17 01:37:32 CEST 2010


Hello all,

I need fixed line spacing in Qt for an app I'm working on. I was able to 
add the relevant code to Qt and send in the patch, but it was rejected as 
the addition is out of the scope for new features for Qt (see 
http://qt.gitorious.org/qt/qt/merge_requests/2305). So I'm trying to 
figure out how to add this feature to Qt another way.

I of course can simply recompile Qt and distribute my patched version of 
Qt along with my program, but I'm trying to avoid doing this so I don't 
have to worry about properly compiling Qt on multiple platforms to work 
with variously configured systems.

The *correct* way to do it seems to be to reimpliment 
QAbstractDocumentLayout to add all the features that the standard text 
layout does, plus my additional feature. This seems prohibitively 
difficult to do correctly, due to the complexity of the standard/default 
text layout class. Has anyone done this though or have any thoughts about 
how to do this easily?

I was wondering if there would be any way to somehow compile a library 
that just consists of a new/modified QTextDocumentLayout (note, not 
QAbstractTextDocumentLayout). The difficulty is that QTextDocumentLayout 
is private and depends on private classes. So I'm guessing this is 
impossible, but maybe there are some linker tricks I'm unaware of that 
would work on multiple platforms (ie. to have a library that contains a 
new QTextDocumentLayout class that 'replaces' the one in Qt)?

Any thoughts?

Thanks.

Josh



More information about the Qt-interest-old mailing list