aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/printlayout.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-07-10 23:03:01 +0300
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-07-10 23:03:01 +0300
commit8fcba14753df4842b8ac48fdbc0498f2715d6884 (patch)
tree0f8a5aacdaafdd22cd468f6e8a587ccdc151c007 /qt-ui/printlayout.cpp
parent9a99aa4c58ff68b4c83363ce5696c41e14069ff6 (diff)
downloadsubsurface-8fcba14753df4842b8ac48fdbc0498f2715d6884.tar.gz
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 <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printlayout.cpp')
-rw-r--r--qt-ui/printlayout.cpp36
1 files changed, 24 insertions, 12 deletions
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 = "<style type='text/css'>" \
- "table { border-width: 1px; border-style: solid; border-color: black; }" \
- "th { font-weight: bold; font-size: large; padding: 3px 10px 3px 10px; }" \
- "td { padding: 3px 10px 3px 10px; }" \
- "</style>";
+ QString styleSheet(
+ "<style type='text/css'>" \
+ "table {" \
+ " border-width: 1px;" \
+ " border-style: solid;" \
+ " border-color: black;" \
+ "}" \
+ "th {" \
+ " background-color: #eeeeee;" \
+ " font-weight: bold;" \
+ " font-size: large;" \
+ " padding: 6px 10px 6px 10px;" \
+ "}" \
+ "td {" \
+ " padding: 3px 10px 3px 10px;" \
+ "}" \
+ "</style>"
+ );
// setDefaultStyleSheet() doesn't work here?
QString htmlText = styleSheet + "<table cellspacing='0' width='100%'>";
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 "<tr><th>TITLE</th><th>TITLE 2</th></tr>";
+ return "<tr><th align='left'>TITLE</th><th align='left'>TITLE 2</th></tr>";
}
QString PrintLayout::insertTableDataRow(struct dive *dive)