From 8fcba14753df4842b8ac48fdbc0498f2715d6884 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 10 Jul 2013 23:03:01 +0300 Subject: Print: cleanup for PrintLayout::printTable() also includes: - experiment with colored background for headings - experiment with 'left' alignment for headings ('th' tag CSS does not support 'text-align') - whitespace fixes Signed-off-by: Lubomir I. Ivanov --- qt-ui/printlayout.cpp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'qt-ui/printlayout.cpp') diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp index daec82af2..cf8c85812 100644 --- a/qt-ui/printlayout.cpp +++ b/qt-ui/printlayout.cpp @@ -74,15 +74,28 @@ void PrintLayout::printTable() { QTextDocument doc; QSizeF pageSize; - pageSize.setWidth(pageRect.width()); - pageSize.setHeight(pageRect.height()); - doc.setPageSize(pageSize); + pageSize.setWidth(pageRect.width()); + pageSize.setHeight(pageRect.height()); + doc.setPageSize(pageSize); - QString styleSheet = ""; + QString styleSheet( + "" + ); // setDefaultStyleSheet() doesn't work here? QString htmlText = styleSheet + ""; QString htmlTextPrev; @@ -92,10 +105,8 @@ void PrintLayout::printTable() int i; struct dive *dive; for_each_dive(i, dive) { - pageCount = pageCountNew; - if (!dive->selected && printOptions->print_selected) { + if (!dive->selected && printOptions->print_selected) continue; - } if (insertHeading) { htmlText += insertTableHeadingRow(); insertHeading = false; @@ -103,6 +114,7 @@ void PrintLayout::printTable() htmlTextPrev = htmlText; htmlText += insertTableDataRow(dive); doc.setHtml(htmlText); + pageCount = pageCountNew; pageCountNew = doc.pageCount(); /* if the page count increases after adding this row we 'revert' * and add a heading instead. */ @@ -119,7 +131,7 @@ void PrintLayout::printTable() QString PrintLayout::insertTableHeadingRow() { - return ""; + return ""; } QString PrintLayout::insertTableDataRow(struct dive *dive) -- cgit v1.2.3-70-g09d2
TITLETITLE 2
TITLETITLE 2