[partition] Explain underlying type for flags variant

This commit is contained in:
Adriaan de Groot 2020-11-04 00:32:21 +01:00
parent 87c77d9807
commit 63964de4bd

View File

@ -56,7 +56,11 @@ flags( const Partition* partition )
{ {
return partition->activeFlags(); return partition->activeFlags();
} }
if ( v.type() == QVariant::Int ) // The underlying type of PartitionTable::Flags can be int or uint
// (see qflags.h) and so setting those flags can create a QVariant
// of those types; we don't just want to check QVariant::canConvert()
// here because that will also accept QByteArray and some other things.
if ( v.type() == QVariant::Int || v.type() == QVariant::UInt )
{ {
return static_cast< PartitionTable::Flags >( v.toInt() ); return static_cast< PartitionTable::Flags >( v.toInt() );
} }