diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-10-03 17:50:40 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-10-03 09:38:37 -0700 |
commit | e727b899a633a6c7eaf075dcf7380aadd6f85b7f (patch) | |
tree | 3293413f356cf1589c7ccc23f8e67d36ad866b7d /qt-ui/models.h | |
parent | 374f3d0de62722cf4153d12754edf6fb110ce33d (diff) | |
download | subsurface-e727b899a633a6c7eaf075dcf7380aadd6f85b7f.tar.gz |
Print: provide means to print profile tables
This patch adds a couple of classes and some other modifications
in PrintLayout that handle the printing of tables under a profile.
models.h : ProfilePrintModel
The class uses a 'struct *dive' to output all required data
for a certain dive at specific rows and columns. It also handles
font formatting and text alignment.
modeldelagatates.h : ProfilePrintDelegate
The class is used only for drawing a custom grid for profile tables.
PrintLayout::createProfileTable()
The function is used to create and setup the profile table object
PrintLayout::printProfileDives()
The function now has correct padding of dive profiles on a page
and also the printing of actual tables below them.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r-- | qt-ui/models.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h index 2a9945aeb..75c3e08ac 100644 --- a/qt-ui/models.h +++ b/qt-ui/models.h @@ -274,4 +274,24 @@ public: int columnCount(const QModelIndex &parent) const; }; +/* ProfilePrintModel: + * this model is used when printing a data table under a profile. it requires + * some exact usage of setSpan(..) on the target QTableView widget. + */ +class ProfilePrintModel : public QAbstractTableModel +{ + Q_OBJECT + +private: + struct dive *dive; + QString truncateString(char *str, const int maxlen) const; + +public: + ProfilePrintModel(QObject *parent = 0); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + void setDive(struct dive *divePtr); +}; + #endif |