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-05-29 15:05:54 +00:00
|
|
|
void removeAccount(int index);
|
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-06-15 15:29:15 +00:00
|
|
|
std::deque<QString> getNames() const;
|
|
|
|
|
2019-05-29 15:05:54 +00:00
|
|
|
signals:
|
|
|
|
void changed();
|
2019-06-15 15:29:15 +00:00
|
|
|
void sizeChanged(unsigned int size);
|
2019-05-29 15:05:54 +00:00
|
|
|
|
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:
|
2019-04-09 15:04:08 +00:00
|
|
|
void onAccountChanged(Models::Item* item, int row, int col);
|
2019-04-03 18:15:36 +00:00
|
|
|
|
2019-03-30 20:13:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MODELS_ACCOUNT_H
|