[PULL REQUEST] table print implementation

Dirk Hohndel dirk at hohndel.org
Thu Jul 11 03:56:14 PDT 2013


On Thu, 2013-07-11 at 13:17 +0300, Lubomir I. Ivanov wrote:
> this is a somehow working table print..it currently uses a print preview dialog
> so that we don't have to export to a file or an actual device while testing.

Nice :-)

> the approach of doing the table print is by using the QTextDocument class
> with HTML/CSS with table/tr/th tags. it allows some freedom of what can be done
> in the table, but not as much as if you draw it manually with cairo/pango
> or with QPainter and this HTML/CSS implementation REALLY is as subset.
> 
> but as you have already guessed it is much easier to maintain, which
> perhaps can be seen in printlayout.cpp...

I think I like this approach. If we do this right it should make it
quite easy to support custom templates that users can create and share.
I know that almost every country has their own preferred logbook format,
and often even more than one. So having the ability for users who just
know a bit of html/css to be able to contribute layouts would be a real
strength for Subsurface...

> it detects a new page by a rather expensive (i think) operation, but it seems
> to work OK, so far.

For 230 or so dives it easily took 13 seconds before the preview came
up. That seems rather long :-)

> to test go to File->Print (all 'print types' modes do a table print for now),
> 'print selected' should work, press 'print'.. 
> 
> comments are welcome.

Thanks for the code. This is one of the major missing pieces and I'm
glad to see progress. It would be really nice to design it early on with
the idea of reading templates and using those to do the layout...

> p.s. i think i saw a couple of divelist bugs, in the lines of dives were
> reported as dive->selected, but weren't selected in the divelist.
> will try to replicate again later. 

That would be great. I've seen and fixed some in the past but I'm sure
there are many more lurking everywhere.

Fundamentally the Qt code has seen a LOT less testing and use. I know
that Linus and I have both started using it (with mixed success, as
Linus' rants here have shown). Who else has actively used the Qt code
for their dive logging?

/D



More information about the subsurface mailing list