lbrycrd/gui/include/transactiontablemodel.h

53 lines
1.4 KiB
C
Raw Normal View History

2011-05-08 22:23:31 +02:00
#ifndef TRANSACTIONTABLEMODEL_H
#define TRANSACTIONTABLEMODEL_H
2011-05-08 16:30:10 +02:00
#include <QAbstractTableModel>
#include <QStringList>
2011-05-27 08:20:23 +02:00
class TransactionTableImpl;
class TransactionRecord;
2011-05-08 16:30:10 +02:00
class TransactionTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
2011-05-08 22:23:31 +02:00
explicit TransactionTableModel(QObject *parent = 0);
2011-05-27 08:20:23 +02:00
~TransactionTableModel();
2011-05-08 22:23:31 +02:00
enum {
Status = 0,
Date = 1,
Description = 2,
Debit = 3,
Credit = 4
2011-05-08 22:23:31 +02:00
} ColumnIndex;
2011-05-08 16:30:10 +02:00
enum {
TypeRole = Qt::UserRole
} RoleIndex;
/* Transaction type */
static const QString Sent;
static const QString Received;
static const QString Generated;
2011-05-08 16:30:10 +02:00
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
2011-05-27 08:20:23 +02:00
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
2011-05-08 16:30:10 +02:00
private:
QStringList columns;
2011-05-27 08:20:23 +02:00
TransactionTableImpl *impl;
QVariant formatTxStatus(const TransactionRecord *wtx) const;
QVariant formatTxDate(const TransactionRecord *wtx) const;
QVariant formatTxDescription(const TransactionRecord *wtx) const;
QVariant formatTxDebit(const TransactionRecord *wtx) const;
QVariant formatTxCredit(const TransactionRecord *wtx) const;
2011-05-08 16:30:10 +02:00
};
#endif