[solved]QVariant to QFont
-
Hello,
can anybody tell me how I can cast a QVariant to QFont?
This QVariant was returned from QAbstractItemView::data(index, Qt::FontRole) and should contain a valid Font...
Unfortunately I have to use Qt 4.5.2, where the member QVariant::toFont() (or the corresponding constructor) does not exist.
Any idea? -
Sure:
@
QFont theFont = qvariant_cast<QFont>(myVariant);
@or
@
QFont theFont = myVariant.value<QFont>();
@ -
Works!
thanks