mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move TablePrintModel to Qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
85d4bb8a70
commit
60dc9f4ab3
6 changed files with 174 additions and 163 deletions
45
qt-models/tableprintmodel.h
Normal file
45
qt-models/tableprintmodel.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef TABLEPRINTMODEL_H
|
||||
#define TABLEPRINTMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
/* TablePrintModel:
|
||||
* for now we use a blank table model with row items TablePrintItem.
|
||||
* these are pretty much the same as DiveItem, but have color
|
||||
* properties, as well. perhaps later one a more unified model has to be
|
||||
* considered, but the current TablePrintModel idea has to be extended
|
||||
* to support variadic column lists and column list orders that can
|
||||
* be controlled by the user.
|
||||
*/
|
||||
struct TablePrintItem {
|
||||
QString number;
|
||||
QString date;
|
||||
QString depth;
|
||||
QString duration;
|
||||
QString divemaster;
|
||||
QString buddy;
|
||||
QString location;
|
||||
unsigned int colorBackground;
|
||||
};
|
||||
|
||||
class TablePrintModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QList<TablePrintItem *> list;
|
||||
|
||||
public:
|
||||
~TablePrintModel();
|
||||
TablePrintModel();
|
||||
|
||||
int rows, columns;
|
||||
void insertRow(int index = -1);
|
||||
void callReset();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue