status-desktop/src-cpp/app/modules/main/wallet/accounts/model.h

46 lines
945 B
C
Raw Normal View History

#ifndef WALLET_ACCOUNT_MODEL_H
#define WALLET_ACCOUNT_MODEL_H
#include <QAbstractListModel>
#include <QHash>
#include <QVector>
#include "item.h"
namespace Modules::Main::Wallet::Accounts
{
class Model : public QAbstractListModel
{
Q_OBJECT
public:
enum ModelRole
{
Name = Qt::UserRole + 1,
Address,
Path,
Color,
PublicKey,
WalletType,
IsWallet,
IsChat,
Assets,
CurrencyBalance
};
explicit Model(QObject* parent = nullptr);
~Model() = default;
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex&) const override;
QVariant data(const QModelIndex& index, int role) const override;
void setItems(const QVector<Item*>& items);
Item* getItemByIndex(int index) const;
private:
QVector<Item*> m_items;
};
} // namespace Modules::Main::Wallet::Accounts
#endif // WALLET_ACCOUNT_MODEL_H