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 "CResourceMimeData.h"
CVirtualDirectoryModel::CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *pParent /*= 0*/)
CVirtualDirectoryModel::CVirtualDirectoryModel(CResourceBrowser *pBrowser, QObject *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(DirectoryMoved(CVirtualDirectory*,CVirtualDirectory*,TString)), this, SLOT(FinishModelChanges()));

View File

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