[PULL REQUEST] table print implementation

Lubomir I. Ivanov neolit123 at gmail.com
Thu Jul 11 03:17:08 PDT 2013

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.

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...

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

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.

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. 

The following changes since commit 74f989bc46a06c124283fa851a06dd093f817c96:

  Print: connect all the options widgets to slots (2013-07-10 11:06:01 +0300)

are available in the git repository at:

  git at github.com:neolit123/subsurface.git print

for you to fetch changes up to 3aae3ff5472d6deada4908fe599714ecdd7e6b61:

  Print: mark some functions in PrintLayout as 'const' (2013-07-11 12:55:48 +0300)

Lubomir I. Ivanov (12):
      Print: add a class for print layouting
      Print: add a setup() method to PrintLayout
      Print: add a print preview for testing purposes
      Print: initial implementation of the table print
      Print: use the actual dive table
      Print: cleanup for PrintLayout::printTable()
      Print: move some header includes to cpp files
      Print: show column titles for table print
      Models: move the declaration of DiveItem to the header
      Models: add the DiveItem::displayDate() helper
      Print: complete columns for the table print
      Print: mark some functions in PrintLayout as 'const'

 Makefile               |   2 +
 qt-ui/models.cpp       |  25 +++----
 qt-ui/models.h         |  16 ++++
 qt-ui/printdialog.cpp  |  17 ++++-
 qt-ui/printdialog.h    |   5 ++
 qt-ui/printlayout.cpp  | 194 +++++++++++++++++++++++++++++++++++++++++++++++++
 qt-ui/printlayout.h    |  39 ++++++++++
 qt-ui/printoptions.cpp |   3 +-
 qt-ui/printoptions.h   |   1 -
 9 files changed, 283 insertions(+), 19 deletions(-)
 create mode 100644 qt-ui/printlayout.cpp
 create mode 100644 qt-ui/printlayout.h

More information about the subsurface mailing list