1
0
forked from blue/squawk
squawk/ui/models/accounts.h

45 lines
1008 B
C
Raw Normal View History

2019-03-30 23:13:13 +03:00
#ifndef MODELS_ACCOUNTS_H
#define MODELS_ACCOUNTS_H
#include <qabstractitemmodel.h>
#include <deque>
2019-04-03 21:15:36 +03:00
#include "account.h"
2019-03-30 23:13:13 +03:00
namespace Models
{
class Accounts : public QAbstractTableModel
{
Q_OBJECT
public:
Accounts(QObject* parent = 0);
~Accounts();
2019-04-03 21:15:36 +03:00
void addAccount(Account* account);
2019-05-29 18:05:54 +03:00
void removeAccount(int index);
2019-03-30 23:13:13 +03: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 21:15:36 +03:00
Account* getAccount(int index);
std::deque<QString> getNames() const;
2019-05-29 18:05:54 +03:00
signals:
void changed();
void sizeChanged(unsigned int size);
2019-05-29 18:05:54 +03:00
2019-03-30 23:13:13 +03:00
private:
2019-04-03 18:09:29 +03:00
std::deque<Account*> accs;
2019-03-30 23:13:13 +03:00
static std::deque<QString> columns;
2019-04-03 21:15:36 +03:00
private slots:
2019-04-09 18:04:08 +03:00
void onAccountChanged(Models::Item* item, int row, int col);
2019-04-03 21:15:36 +03:00
2019-03-30 23:13:13 +03:00
};
}
#endif // MODELS_ACCOUNT_H