[Qt-interest] Using qDebug with a QBitArray and QDataStream

Alex Strickland sscc at mweb.co.za
Wed Feb 2 07:41:29 CET 2011


Hi

Can someone tell me why this doesn't work?:

         QByteArray debugByteArray;
         QDataStream debugStream( &debugByteArray, QIODevice::ReadWrite);
         QBitArray z( 10 );
         z.setBit( 3, true );
         debugStream << z;
         qDebug() << debugByteArray;

or should I say doesn't do what I expect, the output is:

"

I know I can do this:

	QString text;
	for (int i = 0; i < z.size(); ++i)
     		text += z.testBit(i) ? "1": "0";
	qDebug() << text;

so this more about my education than solving my problem!

-- 
Thanks
Alex



More information about the Qt-interest-old mailing list