CPropertyDelegate: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 04:45:03 -04:00
parent d6752c2468
commit e5e2b4be1a
2 changed files with 12 additions and 16 deletions

View File

@ -26,13 +26,8 @@
connect(pRelay, SIGNAL(WidgetEdited(QWidget*, const QModelIndex&)), this, SLOT(WidgetEdited(QWidget*, const QModelIndex&))); \ connect(pRelay, SIGNAL(WidgetEdited(QWidget*, const QModelIndex&)), this, SLOT(WidgetEdited(QWidget*, const QModelIndex&))); \
} }
CPropertyDelegate::CPropertyDelegate(QObject* pParent /*= 0*/) CPropertyDelegate::CPropertyDelegate(QObject* pParent)
: QStyledItemDelegate(pParent) : QStyledItemDelegate(pParent)
, mpEditor(nullptr)
, mpModel(nullptr)
, mInRelayWidgetEdit(false)
, mEditInProgress(false)
, mRelaysBlocked(false)
{ {
mpEditor = UICommon::FindAncestor<IEditor>(pParent); mpEditor = UICommon::FindAncestor<IEditor>(pParent);
} }

View File

@ -9,21 +9,22 @@ class CPropertyDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
IEditor* mpEditor; IEditor* mpEditor = nullptr;
CPropertyModel* mpModel; CPropertyModel* mpModel = nullptr;
bool mInRelayWidgetEdit; bool mInRelayWidgetEdit = false;
mutable bool mEditInProgress; mutable bool mEditInProgress = false;
mutable bool mRelaysBlocked; mutable bool mRelaysBlocked = false;
public: public:
CPropertyDelegate(QObject* pParent = 0); explicit CPropertyDelegate(QObject* pParent = nullptr);
void SetEditor(IEditor* pEditor); void SetEditor(IEditor* pEditor);
void SetPropertyModel(CPropertyModel* pModel); void SetPropertyModel(CPropertyModel* pModel);
virtual QWidget* createEditor(QWidget* pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const; QWidget* createEditor(QWidget* pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const override;
virtual void setEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const; void setEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const override;
virtual void setModelData(QWidget* pEditor, QAbstractItemModel* pModel, const QModelIndex& rkIndex) const; void setModelData(QWidget* pEditor, QAbstractItemModel* pModel, const QModelIndex& rkIndex) const override;
bool eventFilter(QObject* pObject, QEvent* pEvent); bool eventFilter(QObject* pObject, QEvent* pEvent) override;
QWidget* CreateCharacterEditor(QWidget* pParent, const QModelIndex& rkIndex) const; QWidget* CreateCharacterEditor(QWidget* pParent, const QModelIndex& rkIndex) const;
void SetCharacterEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const; void SetCharacterEditorData(QWidget* pEditor, const QModelIndex& rkIndex) const;