- Code: Select all
boost::any_cast<IxModel*>(
QxClassX::create(QStringLiteral("mv::%1_model").arg(model->getClass()->getKey())));
The object gets created, but it cannot get cast to IxModel.
The line will not work, because the model is of a type derived from IxModel, however boost::any_cast will only cast to the actual class, not a parent class.
I can use:
- Code: Select all
qobject_cast<IxModel*>(model->cloneModel());
And then clean it up and do what I want, but should it not be possible to create a new object somehow?
Edit:
- Code: Select all
ixm2->clear();
ixm2->setParentModel(Q_NULLPTR);
ixm2->qxFetchAll();
This is how I try resetting it, however even though it contains the items that it should, this model has issues. E.g. when I create a nested model from it, and add an item to that nested model, and try
- Code: Select all
ixm2->qxSaveRow(row, "the nesting relation");
the relation does not get saved. Trying the same thing with a model created with "new" works as intended.
So now the question is even more relevant.