From 69eacf2c5ee1c84e92153b525fd4302aec0f5f2a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 16 Dec 2022 11:58:38 +0000 Subject: clang-tidy, qt: Fix `modernize-use-default-member-init` in headers See https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html --- src/qt/addressbookpage.cpp | 1 - src/qt/addressbookpage.h | 2 +- src/qt/askpassphrasedialog.cpp | 2 -- src/qt/askpassphrasedialog.h | 4 ++-- src/qt/bitcoin.cpp | 10 ++-------- src/qt/bitcoin.h | 12 ++++++------ src/qt/bitcoinamountfield.cpp | 5 ++--- src/qt/bitcoinamountfield.h | 2 +- src/qt/bitcoingui.cpp | 6 ++---- src/qt/bitcoingui.h | 4 ++-- src/qt/clientmodel.cpp | 2 -- src/qt/clientmodel.h | 4 ++-- src/qt/csvmodelwriter.cpp | 6 +++--- src/qt/csvmodelwriter.h | 2 +- src/qt/editaddressdialog.cpp | 10 ++++------ src/qt/editaddressdialog.h | 4 ++-- src/qt/intro.cpp | 2 -- src/qt/intro.h | 4 ++-- src/qt/modaloverlay.cpp | 11 ++++------- src/qt/modaloverlay.h | 6 +++--- src/qt/notificator.cpp | 4 ---- src/qt/notificator.h | 4 ++-- src/qt/optionsdialog.cpp | 8 +++----- src/qt/optionsdialog.h | 4 ++-- src/qt/overviewpage.cpp | 2 -- src/qt/overviewpage.h | 4 ++-- src/qt/paymentserver.cpp | 7 ++----- src/qt/paymentserver.h | 6 +++--- src/qt/peertablemodel.cpp | 7 +++---- src/qt/peertablemodel.h | 2 +- src/qt/qrimagewidget.cpp | 4 ++-- src/qt/qrimagewidget.h | 2 +- src/qt/qvalidatedlineedit.cpp | 6 ++---- src/qt/qvalidatedlineedit.h | 4 ++-- src/qt/qvaluecombobox.cpp | 4 ++-- src/qt/qvaluecombobox.h | 2 +- src/qt/receivecoinsdialog.cpp | 1 - src/qt/receivecoinsdialog.h | 2 +- src/qt/receiverequestdialog.cpp | 7 +++---- src/qt/receiverequestdialog.h | 2 +- src/qt/recentrequeststablemodel.h | 4 ++-- src/qt/sendcoinsdialog.cpp | 4 ---- src/qt/sendcoinsdialog.h | 8 ++++---- src/qt/sendcoinsentry.cpp | 1 - src/qt/sendcoinsentry.h | 2 +- src/qt/signverifymessagedialog.cpp | 1 - src/qt/signverifymessagedialog.h | 2 +- src/qt/splashscreen.cpp | 2 +- src/qt/splashscreen.h | 2 +- src/qt/trafficgraphwidget.cpp | 13 ++++--------- src/qt/trafficgraphwidget.h | 10 +++++----- src/qt/transactionfilterproxy.cpp | 12 ++++-------- src/qt/transactionfilterproxy.h | 8 ++++---- src/qt/transactiontablemodel.cpp | 1 - src/qt/transactiontablemodel.h | 2 +- src/qt/walletmodel.cpp | 4 ---- src/qt/walletmodel.h | 8 ++++---- src/qt/walletmodeltransaction.cpp | 5 ++--- src/qt/walletmodeltransaction.h | 2 +- src/qt/walletview.cpp | 1 - src/qt/walletview.h | 2 +- 61 files changed, 108 insertions(+), 167 deletions(-) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index a82bd5f73e..53cfa001ed 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -64,7 +64,6 @@ protected: AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) : QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::AddressBookPage), - model(nullptr), mode(_mode), tab(_tab) { diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index 144990f419..283209d00c 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -49,7 +49,7 @@ public Q_SLOTS: private: Ui::AddressBookPage *ui; - AddressTableModel *model; + AddressTableModel* model{nullptr}; Mode mode; Tabs tab; QString returnValue; diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index f16700bfd9..d15aba5cdd 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -23,8 +23,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::AskPassphraseDialog), mode(_mode), - model(nullptr), - fCapsLock(false), m_passphrase_out(passphrase_out) { ui->setupUi(this); diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h index 66031b08d3..370ea1de7e 100644 --- a/src/qt/askpassphrasedialog.h +++ b/src/qt/askpassphrasedialog.h @@ -38,8 +38,8 @@ public: private: Ui::AskPassphraseDialog *ui; Mode mode; - WalletModel *model; - bool fCapsLock; + WalletModel* model{nullptr}; + bool fCapsLock{false}; SecureString* m_passphrase_out; private Q_SLOTS: diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index cc01e4d54a..10a02af799 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -228,14 +228,8 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons static int qt_argc = 1; static const char* qt_argv = "bitcoin-qt"; -BitcoinApplication::BitcoinApplication(): - QApplication(qt_argc, const_cast(&qt_argv)), - optionsModel(nullptr), - clientModel(nullptr), - window(nullptr), - pollShutdownTimer(nullptr), - returnValue(0), - platformStyle(nullptr) +BitcoinApplication::BitcoinApplication() + : QApplication(qt_argc, const_cast(&qt_argv)) { // Qt runs setlocale(LC_ALL, "") on initialization. RegisterMetaTypes(); diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h index 9ad37ca6c9..920b504806 100644 --- a/src/qt/bitcoin.h +++ b/src/qt/bitcoin.h @@ -97,16 +97,16 @@ protected: private: std::optional m_executor; - OptionsModel *optionsModel; - ClientModel *clientModel; - BitcoinGUI *window; - QTimer *pollShutdownTimer; + OptionsModel* optionsModel{nullptr}; + ClientModel* clientModel{nullptr}; + BitcoinGUI* window{nullptr}; + QTimer* pollShutdownTimer{nullptr}; #ifdef ENABLE_WALLET PaymentServer* paymentServer{nullptr}; WalletController* m_wallet_controller{nullptr}; #endif - int returnValue; - const PlatformStyle *platformStyle; + int returnValue{0}; + const PlatformStyle* platformStyle{nullptr}; std::unique_ptr shutdownWindow; SplashScreen* m_splash = nullptr; std::unique_ptr m_node; diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index c92aecd095..4dd151cac0 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -217,9 +217,8 @@ Q_SIGNALS: #include -BitcoinAmountField::BitcoinAmountField(QWidget *parent) : - QWidget(parent), - amount(nullptr) +BitcoinAmountField::BitcoinAmountField(QWidget* parent) + : QWidget(parent) { amount = new AmountSpinBox(this); amount->setLocale(QLocale::c()); diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index a40cd38332..f710915a49 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -74,7 +74,7 @@ protected: bool eventFilter(QObject *object, QEvent *event) override; private: - AmountSpinBox *amount; + AmountSpinBox* amount{nullptr}; QValueComboBox *unit; private Q_SLOTS: diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 2bd38103ed..b5a397ef45 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1541,10 +1541,8 @@ bool BitcoinGUI::isPrivacyModeActivated() const return m_mask_values_action->isChecked(); } -UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) - : optionsModel(nullptr), - menu(nullptr), - m_platform_style{platformStyle} +UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle* platformStyle) + : m_platform_style{platformStyle} { createContextMenu(); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 912e9b95aa..37d9574f1d 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -333,8 +333,8 @@ protected: void changeEvent(QEvent* e) override; private: - OptionsModel *optionsModel; - QMenu* menu; + OptionsModel* optionsModel{nullptr}; + QMenu* menu{nullptr}; const PlatformStyle* m_platform_style; /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 092ffe7e5b..2770dcf46b 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -34,8 +34,6 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO QObject(parent), m_node(node), optionsModel(_optionsModel), - peerTableModel(nullptr), - banTableModel(nullptr), m_thread(new QThread(this)) { cachedBestHeaderHeight = -1; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 4a6abd6a76..69e091cfd5 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -104,9 +104,9 @@ private: std::unique_ptr m_handler_notify_block_tip; std::unique_ptr m_handler_notify_header_tip; OptionsModel *optionsModel; - PeerTableModel *peerTableModel; + PeerTableModel* peerTableModel{nullptr}; PeerTableSortProxy* m_peer_table_sort_proxy{nullptr}; - BanTableModel *banTableModel; + BanTableModel* banTableModel{nullptr}; //! A thread to interact with m_node asynchronously QThread* const m_thread; diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp index 656afb6e87..445ea41475 100644 --- a/src/qt/csvmodelwriter.cpp +++ b/src/qt/csvmodelwriter.cpp @@ -8,9 +8,9 @@ #include #include -CSVModelWriter::CSVModelWriter(const QString &_filename, QObject *parent) : - QObject(parent), - filename(_filename), model(nullptr) +CSVModelWriter::CSVModelWriter(const QString& _filename, QObject* parent) + : QObject(parent), + filename(_filename) { } diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h index ad247b6859..a1e77826a8 100644 --- a/src/qt/csvmodelwriter.h +++ b/src/qt/csvmodelwriter.h @@ -32,7 +32,7 @@ public: private: QString filename; - const QAbstractItemModel *model; + const QAbstractItemModel* model{nullptr}; struct Column { diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index fa27635981..9b3319415d 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -12,12 +12,10 @@ #include -EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) : - QDialog(parent, GUIUtil::dialog_flags), - ui(new Ui::EditAddressDialog), - mapper(nullptr), - mode(_mode), - model(nullptr) +EditAddressDialog::EditAddressDialog(Mode _mode, QWidget* parent) + : QDialog(parent, GUIUtil::dialog_flags), + ui(new Ui::EditAddressDialog), + mode(_mode) { ui->setupUi(this); diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h index f7ad80bb2d..7bfadcfbcc 100644 --- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -49,9 +49,9 @@ private: QString getDuplicateAddressWarning() const; Ui::EditAddressDialog *ui; - QDataWidgetMapper *mapper; + QDataWidgetMapper* mapper{nullptr}; Mode mode; - AddressTableModel *model; + AddressTableModel* model{nullptr}; QString address; }; diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 4c8b33bf28..9ddc7169ee 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -122,8 +122,6 @@ int GetPruneTargetGB() Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_size_gb) : QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::Intro), - thread(nullptr), - signalled(false), m_blockchain_size_gb(blockchain_size_gb), m_chain_state_size_gb(chain_state_size_gb), m_prune_target_gb{GetPruneTargetGB()} diff --git a/src/qt/intro.h b/src/qt/intro.h index d9c45007e1..900c657b27 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -64,9 +64,9 @@ private Q_SLOTS: private: Ui::Intro *ui; - QThread *thread; + QThread* thread{nullptr}; QMutex mutex; - bool signalled; + bool signalled{false}; QString pathToCheck; const int64_t m_blockchain_size_gb; const int64_t m_chain_state_size_gb; diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp index dfa33764f6..66f09fd947 100644 --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -12,13 +12,10 @@ #include #include -ModalOverlay::ModalOverlay(bool enable_wallet, QWidget *parent) : -QWidget(parent), -ui(new Ui::ModalOverlay), -bestHeaderHeight(0), -bestHeaderDate(QDateTime()), -layerIsVisible(false), -userClosed(false) +ModalOverlay::ModalOverlay(bool enable_wallet, QWidget* parent) + : QWidget(parent), + ui(new Ui::ModalOverlay), + bestHeaderDate(QDateTime()) { ui->setupUi(this); connect(ui->closeButton, &QPushButton::clicked, this, &ModalOverlay::closeClicked); diff --git a/src/qt/modaloverlay.h b/src/qt/modaloverlay.h index 682c94cd01..aa470caf07 100644 --- a/src/qt/modaloverlay.h +++ b/src/qt/modaloverlay.h @@ -45,11 +45,11 @@ protected: private: Ui::ModalOverlay *ui; - int bestHeaderHeight; //best known height (based on the headers) + int bestHeaderHeight{0}; // best known height (based on the headers) QDateTime bestHeaderDate; QVector > blockProcessTime; - bool layerIsVisible; - bool userClosed; + bool layerIsVisible{false}; + bool userClosed{false}; QPropertyAnimation m_animation; void UpdateHeaderSyncLabel(); void UpdateHeaderPresyncLabel(int height, const QDateTime& blockDate); diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index b311a9f32e..41ce13dba4 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -32,11 +32,7 @@ Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon QObject(_parent), parent(_parent), programName(_programName), - mode(None), trayIcon(_trayIcon) -#ifdef USE_DBUS - ,interface(nullptr) -#endif { if(_trayIcon && _trayIcon->supportsMessages()) { diff --git a/src/qt/notificator.h b/src/qt/notificator.h index 642d2b29ae..b338637c67 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -61,10 +61,10 @@ private: UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */ }; QString programName; - Mode mode; + Mode mode{None}; QSystemTrayIcon *trayIcon; #ifdef USE_DBUS - QDBusInterface *interface; + QDBusInterface* interface{nullptr}; void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout); #endif diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 7c91eac37e..bfe946bf6b 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -31,11 +31,9 @@ #include #include -OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : - QDialog(parent, GUIUtil::dialog_flags), - ui(new Ui::OptionsDialog), - model(nullptr), - mapper(nullptr) +OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) + : QDialog(parent, GUIUtil::dialog_flags), + ui(new Ui::OptionsDialog) { ui->setupUi(this); diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index e5a19d5025..c14f912cf8 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -75,8 +75,8 @@ Q_SIGNALS: private: Ui::OptionsDialog *ui; ClientModel* m_client_model{nullptr}; - OptionsModel *model; - QDataWidgetMapper *mapper; + OptionsModel* model{nullptr}; + QDataWidgetMapper* mapper{nullptr}; }; #endif // BITCOIN_QT_OPTIONSDIALOG_H diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 85a3c36f39..d56e8ce750 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -140,8 +140,6 @@ private: OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent), ui(new Ui::OverviewPage), - clientModel(nullptr), - walletModel(nullptr), m_platform_style{platformStyle}, txdelegate(new TxViewDelegate(platformStyle, this)) { diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 56f45907db..4c6ae6be58 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -50,8 +50,8 @@ protected: private: Ui::OverviewPage *ui; - ClientModel *clientModel; - WalletModel *walletModel; + ClientModel* clientModel{nullptr}; + WalletModel* walletModel{nullptr}; bool m_privacy{false}; const PlatformStyle* m_platform_style; diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 9f87c15c94..9ddbe789ff 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -126,11 +126,8 @@ bool PaymentServer::ipcSendCommandLine() return fResult; } -PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : - QObject(parent), - saveURIs(true), - uriServer(nullptr), - optionsModel(nullptr) +PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) + : QObject(parent) { // Install global event filter to catch QFileOpenEvents // on Mac: sent when you click bitcoin: links diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h index 08b83244ab..63f4faa772 100644 --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -101,9 +101,9 @@ protected: bool eventFilter(QObject *object, QEvent *event) override; private: - bool saveURIs; // true during startup - QLocalServer* uriServer; - OptionsModel *optionsModel; + bool saveURIs{true}; // true during startup + QLocalServer* uriServer{nullptr}; + OptionsModel* optionsModel{nullptr}; }; #endif // BITCOIN_QT_PAYMENTSERVER_H diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index b7de88225e..2797d830a5 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -14,10 +14,9 @@ #include #include -PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) : - QAbstractTableModel(parent), - m_node(node), - timer(nullptr) +PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) + : QAbstractTableModel(parent), + m_node(node) { // set up timer for auto refresh timer = new QTimer(this); diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index e2515de775..9cbdad4374 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -110,7 +110,7 @@ private: /*: Title of Peers Table column which contains the peer's User Agent string. */ tr("User Agent")}; - QTimer *timer; + QTimer* timer{nullptr}; }; #endif // BITCOIN_QT_PEERTABLEMODEL_H diff --git a/src/qt/qrimagewidget.cpp b/src/qt/qrimagewidget.cpp index 05a67117b6..00f928b355 100644 --- a/src/qt/qrimagewidget.cpp +++ b/src/qt/qrimagewidget.cpp @@ -23,8 +23,8 @@ #include #endif -QRImageWidget::QRImageWidget(QWidget *parent): - QLabel(parent), contextMenu(nullptr) +QRImageWidget::QRImageWidget(QWidget* parent) + : QLabel(parent) { contextMenu = new QMenu(this); contextMenu->addAction(tr("&Save Imageā€¦"), this, &QRImageWidget::saveImage); diff --git a/src/qt/qrimagewidget.h b/src/qt/qrimagewidget.h index 5dbba074a1..d9ca2b899f 100644 --- a/src/qt/qrimagewidget.h +++ b/src/qt/qrimagewidget.h @@ -41,7 +41,7 @@ protected: virtual void contextMenuEvent(QContextMenuEvent *event) override; private: - QMenu *contextMenu; + QMenu* contextMenu{nullptr}; }; #endif // BITCOIN_QT_QRIMAGEWIDGET_H diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp index bd4df75d23..db4e377b87 100644 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -7,10 +7,8 @@ #include #include -QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : - QLineEdit(parent), - valid(true), - checkValidator(nullptr) +QValidatedLineEdit::QValidatedLineEdit(QWidget* parent) + : QLineEdit(parent) { connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid); } diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h index 12d35aa264..b26e2020c5 100644 --- a/src/qt/qvalidatedlineedit.h +++ b/src/qt/qvalidatedlineedit.h @@ -25,8 +25,8 @@ protected: void focusOutEvent(QFocusEvent *evt) override; private: - bool valid; - const QValidator *checkValidator; + bool valid{true}; + const QValidator* checkValidator{nullptr}; public Q_SLOTS: void setText(const QString&); diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index f94486a2f3..c163ba56dc 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -4,8 +4,8 @@ #include -QValueComboBox::QValueComboBox(QWidget *parent) : - QComboBox(parent), role(Qt::UserRole) +QValueComboBox::QValueComboBox(QWidget* parent) + : QComboBox(parent) { connect(this, qOverload(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); } diff --git a/src/qt/qvaluecombobox.h b/src/qt/qvaluecombobox.h index bde9c0d1a6..14379dd612 100644 --- a/src/qt/qvaluecombobox.h +++ b/src/qt/qvaluecombobox.h @@ -28,7 +28,7 @@ Q_SIGNALS: void valueChanged(); private: - int role; + int role{Qt::UserRole}; private Q_SLOTS: void handleSelectionChanged(int idx); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 3c80c01160..f7dd5f7c91 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -25,7 +25,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::ReceiveCoinsDialog), - model(nullptr), platformStyle(_platformStyle) { ui->setupUi(this); diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index a089b8aa6a..0bb02ebcf2 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -51,7 +51,7 @@ public Q_SLOTS: private: Ui::ReceiveCoinsDialog *ui; - WalletModel *model; + WalletModel* model{nullptr}; QMenu *contextMenu; QAction* copyLabelAction; QAction* copyMessageAction; diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index c0135283b1..3453857f98 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -18,10 +18,9 @@ #include /* for USE_QRCODE */ #endif -ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : - QDialog(parent, GUIUtil::dialog_flags), - ui(new Ui::ReceiveRequestDialog), - model(nullptr) +ReceiveRequestDialog::ReceiveRequestDialog(QWidget* parent) + : QDialog(parent, GUIUtil::dialog_flags), + ui(new Ui::ReceiveRequestDialog) { ui->setupUi(this); GUIUtil::handleCloseWindowShortcut(this); diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h index c861680761..d64fee3663 100644 --- a/src/qt/receiverequestdialog.h +++ b/src/qt/receiverequestdialog.h @@ -33,7 +33,7 @@ private Q_SLOTS: private: Ui::ReceiveRequestDialog *ui; - WalletModel *model; + WalletModel* model{nullptr}; SendCoinsRecipient info; }; diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h index cf7cd24ce2..151f8322a8 100644 --- a/src/qt/recentrequeststablemodel.h +++ b/src/qt/recentrequeststablemodel.h @@ -18,11 +18,11 @@ class WalletModel; class RecentRequestEntry { public: - RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION), id(0) { } + RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION) {} static const int CURRENT_VERSION = 1; int nVersion; - int64_t id; + int64_t id{0}; QDateTime date; SendCoinsRecipient recipient; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 57094fc857..cb44e99325 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -64,11 +64,7 @@ int getIndexForConfTarget(int target) { SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::SendCoinsDialog), - clientModel(nullptr), - model(nullptr), m_coin_control(new CCoinControl), - fNewRecipientAllowed(true), - fFeeMinimized(true), platformStyle(_platformStyle) { ui->setupUi(this); diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index dcdf189532..d22020da9f 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -62,12 +62,12 @@ Q_SIGNALS: private: Ui::SendCoinsDialog *ui; - ClientModel *clientModel; - WalletModel *model; + ClientModel* clientModel{nullptr}; + WalletModel* model{nullptr}; std::unique_ptr m_coin_control; std::unique_ptr m_current_transaction; - bool fNewRecipientAllowed; - bool fFeeMinimized; + bool fNewRecipientAllowed{true}; + bool fFeeMinimized{true}; const PlatformStyle *platformStyle; // Copy PSBT to clipboard and offer to save it. diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index af514d5a43..ed2f657cfe 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -22,7 +22,6 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : QWidget(parent), ui(new Ui::SendCoinsEntry), - model(nullptr), platformStyle(_platformStyle) { ui->setupUi(this); diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index ea9d58fbf8..854116bd47 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -73,7 +73,7 @@ protected: private: SendCoinsRecipient recipient; Ui::SendCoinsEntry *ui; - WalletModel *model; + WalletModel* model{nullptr}; const PlatformStyle *platformStyle; bool updateLabel(const QString &address); diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index 1f4b30534b..9e7132e862 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -21,7 +21,6 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent, GUIUtil::dialog_flags), ui(new Ui::SignVerifyMessageDialog), - model(nullptr), platformStyle(_platformStyle) { ui->setupUi(this); diff --git a/src/qt/signverifymessagedialog.h b/src/qt/signverifymessagedialog.h index 1a3708bf8f..4072707b61 100644 --- a/src/qt/signverifymessagedialog.h +++ b/src/qt/signverifymessagedialog.h @@ -35,7 +35,7 @@ protected: private: Ui::SignVerifyMessageDialog *ui; - WalletModel *model; + WalletModel* model{nullptr}; const PlatformStyle *platformStyle; private Q_SLOTS: diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index bf04a6dd5f..7807797f5e 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -28,7 +28,7 @@ SplashScreen::SplashScreen(const NetworkStyle* networkStyle) - : QWidget(), curAlignment(0) + : QWidget() { // set reference point, paddings int paddingRight = 50; diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h index c14fc521a7..9d6a619ce7 100644 --- a/src/qt/splashscreen.h +++ b/src/qt/splashscreen.h @@ -60,7 +60,7 @@ private: QPixmap pixmap; QString curMessage; QColor curColor; - int curAlignment; + int curAlignment{0}; interfaces::Node* m_node = nullptr; bool m_shutdown = false; diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index aebd44d5f7..2558d63a8e 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -19,15 +19,10 @@ #define XMARGIN 10 #define YMARGIN 10 -TrafficGraphWidget::TrafficGraphWidget(QWidget *parent) : - QWidget(parent), - timer(nullptr), - fMax(0.0f), - vSamplesIn(), - vSamplesOut(), - nLastBytesIn(0), - nLastBytesOut(0), - clientModel(nullptr) +TrafficGraphWidget::TrafficGraphWidget(QWidget* parent) + : QWidget(parent), + vSamplesIn(), + vSamplesOut() { timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &TrafficGraphWidget::updateRates); diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h index a40b734540..af9f261946 100644 --- a/src/qt/trafficgraphwidget.h +++ b/src/qt/trafficgraphwidget.h @@ -37,14 +37,14 @@ public Q_SLOTS: private: void paintPath(QPainterPath &path, QQueue &samples); - QTimer *timer; - float fMax; + QTimer* timer{nullptr}; + float fMax{0.0f}; std::chrono::minutes m_range{0}; QQueue vSamplesIn; QQueue vSamplesOut; - quint64 nLastBytesIn; - quint64 nLastBytesOut; - ClientModel *clientModel; + quint64 nLastBytesIn{0}; + quint64 nLastBytesOut{0}; + ClientModel* clientModel{nullptr}; }; #endif // BITCOIN_QT_TRAFFICGRAPHWIDGET_H diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index 3be7e1a969..3cc0cc839d 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -11,14 +11,10 @@ #include #include -TransactionFilterProxy::TransactionFilterProxy(QObject *parent) : - QSortFilterProxyModel(parent), - m_search_string(), - typeFilter(ALL_TYPES), - watchOnlyFilter(WatchOnlyFilter_All), - minAmount(0), - limitRows(-1), - showInactive(true) +TransactionFilterProxy::TransactionFilterProxy(QObject* parent) + : QSortFilterProxyModel(parent), + m_search_string(), + typeFilter(ALL_TYPES) { } diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h index fd9be52842..8e5f72d764 100644 --- a/src/qt/transactionfilterproxy.h +++ b/src/qt/transactionfilterproxy.h @@ -58,10 +58,10 @@ private: std::optional dateTo; QString m_search_string; quint32 typeFilter; - WatchOnlyFilter watchOnlyFilter; - CAmount minAmount; - int limitRows; - bool showInactive; + WatchOnlyFilter watchOnlyFilter{WatchOnlyFilter_All}; + CAmount minAmount{0}; + int limitRows{-1}; + bool showInactive{true}; }; #endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 4312b3cd24..7072881ec1 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -253,7 +253,6 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle QAbstractTableModel(parent), walletModel(parent), priv(new TransactionTablePriv(this)), - fProcessingQueuedTransactions(false), platformStyle(_platformStyle) { subscribeToCoreSignals(); diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index f8576edd59..92ba9bf894 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -89,7 +89,7 @@ private: std::unique_ptr m_handler_show_progress; QStringList columns; TransactionTablePriv *priv; - bool fProcessingQueuedTransactions; + bool fProcessingQueuedTransactions{false}; const PlatformStyle *platformStyle; void subscribeToCoreSignals(); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index ed0602594b..138b0c93bd 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -46,10 +46,6 @@ WalletModel::WalletModel(std::unique_ptr wallet, ClientModel m_client_model(&client_model), m_node(client_model.node()), optionsModel(client_model.getOptionsModel()), - addressTableModel(nullptr), - transactionTableModel(nullptr), - recentRequestsTableModel(nullptr), - cachedEncryptionStatus(Unencrypted), timer(new QTimer(this)) { fHaveWatchOnly = m_wallet->haveWatchOnly(); diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 73dfe0386a..7c8374e7dd 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -181,13 +181,13 @@ private: // (transaction fee, for example) OptionsModel *optionsModel; - AddressTableModel *addressTableModel; - TransactionTableModel *transactionTableModel; - RecentRequestsTableModel *recentRequestsTableModel; + AddressTableModel* addressTableModel{nullptr}; + TransactionTableModel* transactionTableModel{nullptr}; + RecentRequestsTableModel* recentRequestsTableModel{nullptr}; // Cache some values to be able to detect changes interfaces::WalletBalances m_cached_balances; - EncryptionStatus cachedEncryptionStatus; + EncryptionStatus cachedEncryptionStatus{Unencrypted}; QTimer* timer; // Block hash denoting when the last balance update was done. diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index b5538b644f..3178920cf6 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -10,9 +10,8 @@ #include -WalletModelTransaction::WalletModelTransaction(const QList &_recipients) : - recipients(_recipients), - fee(0) +WalletModelTransaction::WalletModelTransaction(const QList& _recipients) + : recipients(_recipients) { } diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 28fb551364..0e6ed8be49 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -41,7 +41,7 @@ public: private: QList recipients; CTransactionRef wtx; - CAmount fee; + CAmount fee{0}; }; #endif // BITCOIN_QT_WALLETMODELTRANSACTION_H diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 10fc0fb6d0..937a9d4d74 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -31,7 +31,6 @@ WalletView::WalletView(WalletModel* wallet_model, const PlatformStyle* _platformStyle, QWidget* parent) : QStackedWidget(parent), - clientModel(nullptr), walletModel(wallet_model), platformStyle(_platformStyle) { diff --git a/src/qt/walletview.h b/src/qt/walletview.h index 301084ffa9..ebceef9cf9 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -50,7 +50,7 @@ public: void showOutOfSyncWarning(bool fShow); private: - ClientModel *clientModel; + ClientModel* clientModel{nullptr}; //! //! The wallet model represents a bitcoin wallet, and offers access to -- cgit v1.2.3