qt, refactor: Pass WalletModel object to WalletView constructor

An instance of the WalletView class without walletModel data member
being set is invalid. So, it is better to set it in the constructor.
This commit is contained in:
Hennadii Stepanov
2021-08-07 17:01:16 +03:00
parent 774a4f517c
commit 404373bc6a
4 changed files with 39 additions and 45 deletions

View File

@@ -35,7 +35,7 @@ class WalletView : public QStackedWidget
Q_OBJECT
public:
explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent);
explicit WalletView(WalletModel* wallet_model, const PlatformStyle* platformStyle, QWidget* parent);
~WalletView();
/** Set the client model.
@@ -43,11 +43,6 @@ public:
*/
void setClientModel(ClientModel *clientModel);
WalletModel *getWalletModel() { return walletModel; }
/** Set the wallet model.
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
functionality.
*/
void setWalletModel(WalletModel *walletModel);
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
@@ -55,7 +50,12 @@ public:
private:
ClientModel *clientModel;
WalletModel *walletModel;
//!
//! The wallet model represents a bitcoin wallet, and offers access to
//! the list of transactions, address book and sending functionality.
//!
WalletModel* const walletModel;
OverviewPage *overviewPage;
QWidget *transactionsPage;