CVirtualDirectoryModel: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 06:14:32 -04:00
parent d80e08a6b3
commit 04bfb17f3c
2 changed files with 19 additions and 24 deletions

View File

@ -2,13 +2,8 @@
#include "CResourceBrowser.h" #include "CResourceBrowser.h"
#include "CResourceMimeData.h" #include "CResourceMimeData.h"
CVirtualDirectoryModel::CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *pParent /*= 0*/) CVirtualDirectoryModel::CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *pParent)
: QAbstractItemModel(pParent) : QAbstractItemModel(pParent)
, mpRoot(nullptr)
, mInsertingRows(false)
, mRemovingRows(false)
, mMovingRows(false)
, mChangingLayout(false)
{ {
connect(pBrowser, SIGNAL(DirectoryAboutToBeMoved(CVirtualDirectory*,QString)), this, SLOT(OnDirectoryAboutToBeMoved(CVirtualDirectory*,QString))); connect(pBrowser, SIGNAL(DirectoryAboutToBeMoved(CVirtualDirectory*,QString)), this, SLOT(OnDirectoryAboutToBeMoved(CVirtualDirectory*,QString)));
connect(pBrowser, SIGNAL(DirectoryMoved(CVirtualDirectory*,CVirtualDirectory*,TString)), this, SLOT(FinishModelChanges())); connect(pBrowser, SIGNAL(DirectoryMoved(CVirtualDirectory*,CVirtualDirectory*,TString)), this, SLOT(FinishModelChanges()));

View File

@ -9,28 +9,28 @@
class CVirtualDirectoryModel : public QAbstractItemModel class CVirtualDirectoryModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT
CVirtualDirectory *mpRoot; CVirtualDirectory *mpRoot = nullptr;
bool mInsertingRows; bool mInsertingRows = false;
bool mRemovingRows; bool mRemovingRows = false;
bool mMovingRows; bool mMovingRows = false;
bool mChangingLayout; bool mChangingLayout = false;
public: public:
CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *pParent = 0); explicit CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *pParent = nullptr);
QModelIndex index(int Row, int Column, const QModelIndex& rkParent) const; QModelIndex index(int Row, int Column, const QModelIndex& rkParent) const override;
QModelIndex parent(const QModelIndex& rkChild) const; QModelIndex parent(const QModelIndex& rkChild) const override;
int rowCount(const QModelIndex& rkParent) const; int rowCount(const QModelIndex& rkParent) const override;
int columnCount(const QModelIndex& /*rkParent*/) const; int columnCount(const QModelIndex& /*rkParent*/) const override;
QVariant data(const QModelIndex& rkIndex, int Role) const; QVariant data(const QModelIndex& rkIndex, int Role) const override;
bool setData(const QModelIndex& rkIndex, const QVariant& rkValue, int Role); bool setData(const QModelIndex& rkIndex, const QVariant& rkValue, int Role) override;
Qt::ItemFlags flags(const QModelIndex& rkIndex) const; Qt::ItemFlags flags(const QModelIndex& rkIndex) const override;
bool canDropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent) const; bool canDropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent) const override;
bool dropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent); bool dropMimeData(const QMimeData *pkData, Qt::DropAction Action, int Row, int Column, const QModelIndex& rkParent) override;
QMimeData* mimeData(const QModelIndexList& rkIndexes) const; QMimeData* mimeData(const QModelIndexList& rkIndexes) const override;
Qt::DropActions supportedDragActions() const; Qt::DropActions supportedDragActions() const override;
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const override;
QModelIndex GetIndexForDirectory(CVirtualDirectory *pDir); QModelIndex GetIndexForDirectory(CVirtualDirectory *pDir);
CVirtualDirectory* IndexDirectory(const QModelIndex& rkIndex) const; CVirtualDirectory* IndexDirectory(const QModelIndex& rkIndex) const;