Answer the question
In order to leave comments, you need to log in
Why is qvariant_cast acting weird?
Greetings!
In general, there is a certain pointer to a class (for example, ProductItem), you need to pass it using QVariant,
I pass it like this:
ProductItem * item = new ProductItem(this);
QVariant MyClass::getItem()
{
return qVariantFromValue(static_cast<WBaseItem*>(item));
}
WBaseItem * item = qvariant_cast<WBaseItem*>(getItem());
qDebug()<<getItem();
is explicitly specified QVariant(WBaseItem*, ProductItem(0x1665e70) )
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question