refs #614, allow CCached::NotifySlot to refer to a base class method

This commit is contained in:
Mathew Sutcliffe
2016-04-24 16:26:58 +01:00
committed by Klaus Basan
parent 43f9515eaa
commit bf2a84b67c
3 changed files with 17 additions and 2 deletions

View File

@@ -202,7 +202,7 @@ namespace BlackMisc
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheFs9> m_modelCacheFs9 {this, &CModelCaches::changedFs9 }; //!< FS9 cache
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheP3D> m_modelCacheP3D {this, &CModelCaches::changedP3D }; //!< P3D cache
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheXP> m_modelCacheXP {this, &CModelCaches::changedXP }; //!< XP cache
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheLastSelection> m_currentSimulator {this }; //!< surrent simulator
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheLastSelection> m_currentSimulator { this }; //!< current simulator
};
//! Bundle of caches for model sets of all simulators

View File

@@ -271,7 +271,7 @@ namespace BlackMisc
//! Type of pointer to non-const member function of U taking no arguments and returning void,
//! for slot parameter of CCached constructor.
template <typename U>
using NotifySlot = void (U::*)();
using NotifySlot = Private::NonDeduced<void (U::*)()>;
//! Constructor.
//! \param cache The CValueCache object which manages the value.

View File

@@ -27,6 +27,21 @@ namespace BlackMisc
namespace Private
{
/*!
* \private Identity type trait.
*/
template <typename T>
struct Identity
{
using type = T;
};
/*!
* \private Trick to force a non-deduced context during template argument type deduction.
*/
template <typename T>
using NonDeduced = typename Identity<T>::type;
/*!
* \private QObject subclass used by CCached<T> class template for signal/slot communication with CValueCache.
* An instance of this class is shared between all CCached<T> referring to the same CValueCache and owned by the same QObject,