[Qt-interest] QTextDocumentLayout patch? OR modifying private classes?
Stephen Jackson
spjackson42 at gmail.com
Mon May 17 11:08:19 CEST 2010
On 17 May 2010 00:37, Josh wrote:
>
> 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?
>
Hi Josh,
I completely agree with everything you've said. My use case for this
is printing on pre-printed forms where I need to precisely control the
Y co-ordinate. Your patch was just what I needed, as I wrote in my
comment on the patch. I agree with you that this is a very useful
feature and the performance hit for those who don't use it is
negligible. It's not as though the functionality we require is
esoteric. The decision to rule it "out of scope" sounds like "not
invented here" syndrome. I am very disappointed.
There is an awful lot of code in QTextDocumentLayout and the classes
with which it is intertwined. This means that it is impractical to
create my own class derived from QAbstractTextDocumentLayout and start
from scratch to provide "QTextDocument plus" functionality. So what I
would have to do would be to fork QTextDocumentLayout (and related
classes) as my own class and merge your patch into that. Such forking
is not very desirable.
Thanks again for your patch.
--
Cheers,
Stephen Jackson
More information about the Qt-interest-old
mailing list