diff --git a/Base/Util/IFactory.h b/Base/Util/IFactory.h index 81da769aea0bacd9e4b8d1636e6b3a904e43fb55..8000cc0811ec4fd6b7e70d3561847a240fdbe411 100644 --- a/Base/Util/IFactory.h +++ b/Base/Util/IFactory.h @@ -65,16 +65,4 @@ protected: CallbackMap_t m_callbacks; //!< map of correspondence of objectsId and creation functions }; -//! Returns new instance of class T. -//! -//! This templated function is used in catalogs in form of a function pointer -//! 'create_new<T>', with no function arguments supplied. Equivalently, we could -//! use a lambda function '[](){return new T;}'. - -template <class T> -T* create_new() -{ - return new T(); -} - #endif // BORNAGAIN_BASE_UTIL_IFACTORY_H diff --git a/GUI/View/Data/DatafilePresenter.cpp b/GUI/View/Data/DatafilePresenter.cpp index 7a5e3af4b8e564d1a66921811a4c4e43d4492775..1c2241dd270b63cabf2715b808d7d1e72d88384d 100644 --- a/GUI/View/Data/DatafilePresenter.cpp +++ b/GUI/View/Data/DatafilePresenter.cpp @@ -22,10 +22,10 @@ DatafilePresenter::DatafilePresenter() { - registerWidget("Heat Map", create_new<Plot2DFrame>); - registerWidget("Projections", create_new<Plot2DWithProjectionFrame>); - registerWidget("Mask Editor", create_new<MaskEditingFrame>); - registerWidget("Reflectometry (Graph only)", create_new<SpecularFrame>); + registerWidget("Heat Map", []() { return new Plot2DFrame; }); + registerWidget("Projections", []() { return new Plot2DWithProjectionFrame; }); + registerWidget("Mask Editor", []() { return new MaskEditingFrame; }); + registerWidget("Reflectometry (Graph only)", []() { return new SpecularFrame; }); } QString DatafilePresenter::itemPresentation() const diff --git a/GUI/View/Job/JobResultsPresenter.cpp b/GUI/View/Job/JobResultsPresenter.cpp index f1bc40dcd677d9ddc0768e13b9486e412a85e6fa..f096b867aa2a15e20277f331c0218d8b06e5531b 100644 --- a/GUI/View/Job/JobResultsPresenter.cpp +++ b/GUI/View/Job/JobResultsPresenter.cpp @@ -48,11 +48,11 @@ JobResultsPresenter::JobResultsPresenter() setWindowTitle("Job Datafield"); setObjectName("JobResultsPresenter"); - registerWidget("Heat Map", create_new<Plot2DFrame>); - registerWidget("Projections", create_new<Plot2DWithProjectionFrame>); - registerWidget("Fit 1D Data", create_new<Fit1DFrame>); - registerWidget("Fit 2D Data", create_new<Fit2DFrame>); - registerWidget("Reflectometry", create_new<SpecularFrame>); + registerWidget("Heat Map", []() { return new Plot2DFrame; }); + registerWidget("Projections", []() { return new Plot2DWithProjectionFrame; }); + registerWidget("Fit 1D Data", []() { return new Fit1DFrame; }); + registerWidget("Fit 2D Data", []() { return new Fit2DFrame; }); + registerWidget("Reflectometry", []() { return new SpecularFrame; }); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setMinimumSize(220, 200);