Print: setup for a new profile table layout

- Adjust the new rows and column count
- Set new row and column spans

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2013-11-30 14:38:54 +02:00
parent d668f5dc8e
commit 3b7500fd33
2 changed files with 15 additions and 24 deletions

View file

@ -1593,12 +1593,12 @@ void ProfilePrintModel::setDive(struct dive *divePtr)
int ProfilePrintModel::rowCount(const QModelIndex &parent) const
{
return 11;
return 12;
}
int ProfilePrintModel::columnCount(const QModelIndex &parent) const
{
return 7;
return 5;
}
QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const

View file

@ -36,14 +36,12 @@ PrintLayout::PrintLayout(PrintDialog *dialogPtr, QPrinter *printerPtr, struct op
tablePrintColumnWidths.append(15);
tablePrintColumnWidths.append(33);
// profile print settings
const int dw = 15; // base percentage
const int dw = 20; // base percentage
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw - 5);
profilePrintColumnWidths.append(dw + 5);
profilePrintColumnWidths.append(dw - 5); // fit to 100%
profilePrintColumnWidths.append(dw); // fit to 100%
const int sr = 9; // smallest row height in pixels
profilePrintRowHeights.append(sr + 2);
profilePrintRowHeights.append(sr + 7);
@ -55,7 +53,8 @@ PrintLayout::PrintLayout(PrintDialog *dialogPtr, QPrinter *printerPtr, struct op
profilePrintRowHeights.append(sr);
profilePrintRowHeights.append(sr);
profilePrintRowHeights.append(sr);
profilePrintRowHeights.append(sr + 12);
profilePrintRowHeights.append(sr);
profilePrintRowHeights.append(sr);
}
void PrintLayout::print()
@ -211,23 +210,15 @@ QTableView *PrintLayout::createProfileTable(ProfilePrintModel *model, const int
* changes made here reflect on ProfilePrintModel::data(). */
const int cols = model->columnCount();
const int rows = model->rowCount();
// top section
table->setSpan(0, 0, 1, cols - 2);
table->setSpan(1, 0, 1, cols - 2);
table->setSpan(10, 0, 1, cols);
table->setSpan(0, 5, 1, 2);
table->setSpan(1, 5, 1, 12);
// sac, cns, otu
table->setSpan(2, 3, 2, 1);
table->setSpan(4, 3, 2, 1);
table->setSpan(6, 3, 2, 1);
table->setSpan(8, 3, 2, 1);
table->setSpan(2, 4, 2, 1);
table->setSpan(4, 4, 2, 1);
table->setSpan(6, 4, 2, 1);
table->setSpan(8, 4, 2, 1);
// weights
table->setSpan(2, 5, 1, 2);
// info on top
table->setSpan(0, 0, 1, 4);
table->setSpan(1, 0, 1, 4);
// gas used
table->setSpan(2, 0, 1, 2);
table->setSpan(3, 0, 1, 2);
// notes
table->setSpan(6, 0, 1, 5);
table->setSpan(7, 0, 5, 5);
/* resize row heights to the 'profilePrintRowHeights' indexes.
* profilePrintTableMaxH will then hold the table height. */