I am using C++ Builder 10.2.3 (Rad Studio 10.2.3) I am trying to convert a TRectF to a Variant. But it seems not to be working:
- 1st Solution: using TValue::From(rect).AsVariant() or AsType(). I am getting the error message: Invalid Class TypeCast
- 2e Solution: Using TValue::Make() with ExtractRawData. But I cannot use it because __delphirtti() cannot work with TRectF.
This is an example of code from Qt I am trying to adapt:
void File::appendRects(const QList<QRectF> &rects)
{
QList<QVariant> newRects = m_metadata["Rects"].toList();
foreach (const QRectF &rect, rects)
newRects.append(rect);
m_metadata["Rects"] = newRects;
}
The code line newRects.append(rect); adds a QRectF to a QVariant list. Which means that the conversion is done automatically.
Any solution which works?