In fact, cast operations on vtkDataSet subclasses contained in QVariant are OK provided that
dtk::visualization::registerVTKToMetaType function is called before
ask for conversions.
This function is embedded into the more generic
dtk::visualization::initialize function that initializes the layer of
So for any application using dtkVisualization layer, one must initialize it using this function to ensure such cast operations.
Tests were added to check that the downcast from vtkDataSet to any
subclasses is working even if a pointer of a vtkDataSet is given to the
vtkDataSet *data = vtkImageData::New(); QVariant v = dtk::variantFromValue(data); QVERIFY(v.userType() == QMetaType::type("vtkImageData*"));