logos-execution-zone-wallet-ui/src/LEZAccountFilterModel.h

41 lines
1.4 KiB
C
Raw Normal View History

2026-02-22 02:03:13 +05:30
#pragma once
#include <QSortFilterProxyModel>
#include "LEZWalletAccountModel.h"
class LEZAccountFilterModel : public QSortFilterProxyModel {
Q_OBJECT
Q_PROPERTY(bool filterByPublic READ filterByPublic WRITE setFilterByPublic NOTIFY filterByPublicChanged)
2026-07-24 00:24:03 -03:00
Q_PROPERTY(bool onlyInitialized READ onlyInitialized WRITE setOnlyInitialized NOTIFY onlyInitializedChanged)
2026-02-22 02:03:13 +05:30
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
explicit LEZAccountFilterModel(QObject* parent = nullptr);
bool filterByPublic() const { return m_filterByPublic; }
void setFilterByPublic(bool value);
2026-07-24 00:24:03 -03:00
// When true, uninitialized accounts are excluded. Used for the account-picker
// combo boxes (transfer/withdraw "from"/"to" fields) where an uninitialized
// account can't yet be a valid sender or recipient — as opposed to AccountsPanel's
// unfiltered accountModel, which must keep showing them so the user can initialize.
bool onlyInitialized() const { return m_onlyInitialized; }
void setOnlyInitialized(bool value);
2026-02-22 02:03:13 +05:30
int count() const { return rowCount(); }
Q_INVOKABLE int rowForAddress(const QString& address) const;
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
signals:
void filterByPublicChanged();
2026-07-24 00:24:03 -03:00
void onlyInitializedChanged();
2026-02-22 02:03:13 +05:30
void countChanged();
private:
bool m_filterByPublic = true;
2026-07-24 00:24:03 -03:00
bool m_onlyInitialized = false;
2026-02-22 02:03:13 +05:30
};