QVariant to/from QFlag
I'm unit testing a function for a table model, where it emits 'headerDataChanged'. One of the fields in this signal is a 'Qt::Orientation' flag. When a QSignalSpy picks it up, the QVariant for the orientation field is an invalid one. I can't cast back to Qt::Orientation. Do I have to locally declare orientation as a metatype? It seems odd it wouldn't just treat it as an int or something.
Can you show the code from that part ?
In Qt 5.7 it seems happy about it
QVariant test; test.setValue(Qt::Orientation::Vertical); Qt::Orientation back = test.value<Qt::Orientation >(); qDebug() << "i see " << back;