QGIM: initialize function pointers when constructing base class
Initialize them as part of the base-class constructor rather than through an explicit init-call. Coverity-Id: 478630 Change-Id: Ibd97630418650f72668be20ca3cff7f24eec8387 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
a79d5b8d08
commit
cd870ed5eb
@ -149,10 +149,9 @@ protected:
|
||||
>;
|
||||
public:
|
||||
explicit QGenericItemModelImpl(Range &&model, QGenericItemModel *itemModel)
|
||||
: QGenericItemModelImplBase(itemModel)
|
||||
: QGenericItemModelImplBase(itemModel, static_cast<const Self*>(nullptr))
|
||||
, m_data{std::forward<Range>(model)}
|
||||
{
|
||||
initFrom(this);
|
||||
}
|
||||
|
||||
// static interface, called by QGenericItemModelImplBase
|
||||
|
@ -326,8 +326,9 @@ private:
|
||||
CallTupleFN *call_fn;
|
||||
|
||||
protected:
|
||||
explicit QGenericItemModelImplBase(QGenericItemModel *itemModel)
|
||||
: m_itemModel(itemModel)
|
||||
template <typename Impl> // type deduction
|
||||
explicit QGenericItemModelImplBase(QGenericItemModel *itemModel, const Impl *)
|
||||
: callConst_fn(&Impl::callConst), call_fn(&Impl::call), m_itemModel(itemModel)
|
||||
{}
|
||||
~QGenericItemModelImplBase() = default;
|
||||
|
||||
@ -346,13 +347,6 @@ protected:
|
||||
inline void beginRemoveRows(const QModelIndex &parent, int start, int count);
|
||||
inline void endRemoveRows();
|
||||
|
||||
template <typename Impl>
|
||||
void initFrom(Impl *)
|
||||
{
|
||||
callConst_fn = &Impl::callConst;
|
||||
call_fn = &Impl::call;
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename Ret, typename ...Args>
|
||||
Ret callConst(ConstOp op, const Args &...args) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user