From e5e2b4be1a8f353e062f891b5e0ad856690612c0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 28 Jun 2020 04:45:03 -0400 Subject: [PATCH] CPropertyDelegate: Make use of in-class initializers where applicable --- src/Editor/PropertyEdit/CPropertyDelegate.cpp | 7 +------ src/Editor/PropertyEdit/CPropertyDelegate.h | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/Editor/PropertyEdit/CPropertyDelegate.cpp b/src/Editor/PropertyEdit/CPropertyDelegate.cpp index 10dcea2d..7ce8786e 100644 --- a/src/Editor/PropertyEdit/CPropertyDelegate.cpp +++ b/src/Editor/PropertyEdit/CPropertyDelegate.cpp @@ -26,13 +26,8 @@ connect(pRelay, SIGNAL(WidgetEdited(QWidget*, const QModelIndex&)), this, SLOT(WidgetEdited(QWidget*, const QModelIndex&))); \ } -CPropertyDelegate::CPropertyDelegate(QObject* pParent /*= 0*/) +CPropertyDelegate::CPropertyDelegate(QObject* pParent) : QStyledItemDelegate(pParent) - , mpEditor(nullptr) - , mpModel(nullptr) - , mInRelayWidgetEdit(false) - , mEditInProgress(false) - , mRelaysBlocked(false) { mpEditor = UICommon::FindAncestor(pParent); } diff --git a/src/Editor/PropertyEdit/CPropertyDelegate.h b/src/Editor/PropertyEdit/CPropertyDelegate.h index f9a998d8..45a4ef46 100644 --- a/src/Editor/PropertyEdit/CPropertyDelegate.h +++ b/src/Editor/PropertyEdit/CPropertyDelegate.h @@ -9,21 +9,22 @@ class CPropertyDelegate : public QStyledItemDelegate { Q_OBJECT - IEditor* mpEditor; - CPropertyModel* mpModel; - bool mInRelayWidgetEdit; - mutable bool mEditInProgress; - mutable bool mRelaysBlocked; + IEditor* mpEditor = nullptr; + CPropertyModel* mpModel = nullptr; + bool mInRelayWidgetEdit = false; + mutable bool mEditInProgress = false; + mutable bool mRelaysBlocked = false; public: - CPropertyDelegate(QObject* pParent = 0); + explicit CPropertyDelegate(QObject* pParent = nullptr); + void SetEditor(IEditor* pEditor); void SetPropertyModel(CPropertyModel* pModel); - virtual QWidget* createEditor(QWidget* pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const; - virtual void setEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const; - virtual void setModelData(QWidget* pEditor, QAbstractItemModel* pModel, const QModelIndex& rkIndex) const; - bool eventFilter(QObject* pObject, QEvent* pEvent); + QWidget* createEditor(QWidget* pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const override; + void setEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const override; + void setModelData(QWidget* pEditor, QAbstractItemModel* pModel, const QModelIndex& rkIndex) const override; + bool eventFilter(QObject* pObject, QEvent* pEvent) override; QWidget* CreateCharacterEditor(QWidget* pParent, const QModelIndex& rkIndex) const; void SetCharacterEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const;