vtkQtLabelRenderStrategy: can't use internal class Internals when deriving
The class vtkQtLabelRenderStrategy
uses an nested class vtkQtLabelRenderStrategy::Internals
. In the according header file this class is only forward declared and used via a pointer to it. The visibility of that pointer is protected, suggesting, that it should be possible to use it in a derived class (see the following code snippet):
protected:
vtkQtLabelRenderStrategy();
~vtkQtLabelRenderStrategy() override;
class Internals;
Internals* Implementation;
Now a problem arises when you actually want to use the pointer Implementation
in a derived class (which we have a use case for): since the Implementation
class vtkQtLabelRenderStrategy::Internals
is in the vtkQtLabelRenderStrategy.cxx
file you provoke an error like
invalid use of undefined type 'class vtkQtLabelRenderStrategy::Internals'
I would see two solutions:
- Move the implementation from
vtkQtLabelRenderStrategy.cxx
tovtkQtLabelRenderStrategy.h
file. This is what we currently do in a patch to get it compiling - If you want to keep the vtkQtLabelRenderStrategy.h file clean, move the implementation to a file
vtkQtLabelRenderStrategyInternals.h
which you would only include when deriving fromvtkQtLabelRenderStrategy
.
I think solution (2) would be the cleaner one.