PDA

View Full Version : Empty QBitArray problem



MarkoSan
21st March 2011, 14:19
Hi to all!

I have following method:
void CentralWidget::routerInfoWordBreakDown(const short& routerinfoword)
{
QBitArray bit_array(QVariant(routerinfoword).toBitArray());

for(quint64 iIndex=0; iIndex<bit_array.size(); iIndex++)
{
this->gbLog()->teLog()->append(QString("Bit %1:").arg(iIndex));
}
}

Why is bit_array empty?

Sincerely,
Marko

high_flyer
21st March 2011, 15:06
Why is bit_array empty?
Does your QVarian::type() return 'BitArray'?


QBitArray QVariant::toBitArray () const

Returns the variant as a QBitArray if the variant has type() BitArray; otherwise returns an empty bit array.

See also canConvert() and convert().