CResourceSelector: Make use of in-class initializers where applicable
This commit is contained in:
parent
11690ab6b5
commit
61ed4163fb
|
@ -16,11 +16,8 @@
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
CResourceSelector::CResourceSelector(QWidget *pParent /*= 0*/)
|
CResourceSelector::CResourceSelector(QWidget *pParent)
|
||||||
: QWidget(pParent)
|
: QWidget(pParent)
|
||||||
, mpResEntry(nullptr)
|
|
||||||
, mIsEditable(true)
|
|
||||||
, mIsDragging(false)
|
|
||||||
{
|
{
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
|
@ -12,9 +12,9 @@ class CResourceSelector : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
CResourceEntry *mpResEntry;
|
CResourceEntry *mpResEntry = nullptr;
|
||||||
CResTypeFilter mTypeFilter;
|
CResTypeFilter mTypeFilter;
|
||||||
bool mIsEditable;
|
bool mIsEditable = true;
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
QVBoxLayout *mpLayout;
|
QVBoxLayout *mpLayout;
|
||||||
|
@ -30,11 +30,12 @@ class CResourceSelector : public QWidget
|
||||||
QAction *mpCopyPathAction;
|
QAction *mpCopyPathAction;
|
||||||
|
|
||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
bool mIsDragging;
|
bool mIsDragging = false;
|
||||||
QPoint mDragStartPosition;
|
QPoint mDragStartPosition;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CResourceSelector(QWidget *pParent = 0);
|
explicit CResourceSelector(QWidget *pParent = nullptr);
|
||||||
|
|
||||||
void SetFrameVisible(bool Visible);
|
void SetFrameVisible(bool Visible);
|
||||||
void SetEditable(bool Editable);
|
void SetEditable(bool Editable);
|
||||||
void SetTypeFilter(const CResTypeFilter& rkFilter);
|
void SetTypeFilter(const CResTypeFilter& rkFilter);
|
||||||
|
@ -44,21 +45,21 @@ public:
|
||||||
void SetResource(CResource *pRes);
|
void SetResource(CResource *pRes);
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
bool eventFilter(QObject *pWatched, QEvent *pEvent);
|
bool eventFilter(QObject *pWatched, QEvent *pEvent) override;
|
||||||
|
|
||||||
// Drag
|
// Drag
|
||||||
void mousePressEvent(QMouseEvent *pEvent);
|
void mousePressEvent(QMouseEvent *pEvent) override;
|
||||||
void mouseMoveEvent(QMouseEvent *pEvent);
|
void mouseMoveEvent(QMouseEvent *pEvent) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *pEvent);
|
void mouseReleaseEvent(QMouseEvent *pEvent) override;
|
||||||
|
|
||||||
// Drop
|
// Drop
|
||||||
void dragEnterEvent(QDragEnterEvent *pEvent);
|
void dragEnterEvent(QDragEnterEvent *pEvent) override;
|
||||||
void dropEvent(QDropEvent *pEvent);
|
void dropEvent(QDropEvent *pEvent) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CResourceEntry* Entry() const { return mpResEntry; }
|
CResourceEntry* Entry() const { return mpResEntry; }
|
||||||
inline const CResTypeFilter& TypeFilter() const { return mTypeFilter; }
|
const CResTypeFilter& TypeFilter() const { return mTypeFilter; }
|
||||||
inline bool IsEditable() const { return mIsEditable; }
|
bool IsEditable() const { return mIsEditable; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void CreateContextMenu(const QPoint& rkPoint);
|
void CreateContextMenu(const QPoint& rkPoint);
|
||||||
|
|
Loading…
Reference in New Issue