CSelectResourcePanel: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 05:52:15 -04:00
parent 5a041dd474
commit c96ed14062
2 changed files with 6 additions and 7 deletions

View File

@ -7,7 +7,7 @@
CSelectResourcePanel::CSelectResourcePanel(CResourceSelector *pSelector) CSelectResourcePanel::CSelectResourcePanel(CResourceSelector *pSelector)
: QFrame(pSelector) : QFrame(pSelector)
, mpUI(new Ui::CSelectResourcePanel) , mpUI(std::make_unique<Ui::CSelectResourcePanel>())
, mpSelector(pSelector) , mpSelector(pSelector)
, mModel(pSelector) , mModel(pSelector)
{ {
@ -69,10 +69,7 @@ CSelectResourcePanel::CSelectResourcePanel(CResourceSelector *pSelector)
mpUI->SearchBar->setFocus(); mpUI->SearchBar->setFocus();
} }
CSelectResourcePanel::~CSelectResourcePanel() CSelectResourcePanel::~CSelectResourcePanel() = default;
{
delete mpUI;
}
// Slots // Slots
void CSelectResourcePanel::FocusChanged(QWidget*, QWidget *pNew) void CSelectResourcePanel::FocusChanged(QWidget*, QWidget *pNew)

View File

@ -5,6 +5,8 @@
#include "CFilteredResourceModel.h" #include "CFilteredResourceModel.h"
#include "CResourceSelector.h" #include "CResourceSelector.h"
#include <memory>
namespace Ui { namespace Ui {
class CSelectResourcePanel; class CSelectResourcePanel;
} }
@ -12,7 +14,7 @@ class CSelectResourcePanel;
class CSelectResourcePanel : public QFrame class CSelectResourcePanel : public QFrame
{ {
Q_OBJECT Q_OBJECT
Ui::CSelectResourcePanel *mpUI; std::unique_ptr<Ui::CSelectResourcePanel> mpUI;
CResourceSelector *mpSelector; CResourceSelector *mpSelector;
CFilteredResourceModel mModel; CFilteredResourceModel mModel;
@ -20,7 +22,7 @@ class CSelectResourcePanel : public QFrame
public: public:
explicit CSelectResourcePanel(CResourceSelector *pSelector); explicit CSelectResourcePanel(CResourceSelector *pSelector);
~CSelectResourcePanel(); ~CSelectResourcePanel() override;
public slots: public slots:
void FocusChanged(QWidget *pOld, QWidget *pNew); void FocusChanged(QWidget *pOld, QWidget *pNew);