squawk/ui/models/accounts.h

38 lines
825 B
C
Raw Normal View History

2019-03-30 20:13:13 +00:00
#ifndef MODELS_ACCOUNTS_H
#define MODELS_ACCOUNTS_H
#include <qabstractitemmodel.h>
#include <deque>
2019-04-03 18:15:36 +00:00
#include "account.h"
2019-03-30 20:13:13 +00:00
namespace Models
{
class Accounts : public QAbstractTableModel
{
Q_OBJECT
public:
Accounts(QObject* parent = 0);
~Accounts();
2019-04-03 18:15:36 +00:00
void addAccount(Account* account);
2019-03-30 20:13:13 +00:00
QVariant data ( const QModelIndex& index, int role ) const override;
int columnCount ( const QModelIndex& parent ) const override;
int rowCount ( const QModelIndex& parent ) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
2019-04-03 18:15:36 +00:00
Account* getAccount(int index);
2019-03-30 20:13:13 +00:00
private:
2019-04-03 15:09:29 +00:00
std::deque<Account*> accs;
2019-03-30 20:13:13 +00:00
static std::deque<QString> columns;
2019-04-03 18:15:36 +00:00
private slots:
void onAccountChanged(int column);
2019-03-30 20:13:13 +00:00
};
}
#endif // MODELS_ACCOUNT_H