- forever
This is a macro that expands to for (;;). Very useful. You're already using foreach already right? - qChecksum
This returns a CRC-16 checksum of a char* buffer. - qCompress / qUncompress
These functions perform zlib compression/uncompression of a QByteArray. You can also specify the compression level. - qFuzzyCompare
Use this to safely compare float/double values and avoid the dreaded floating point comparison trap. - qVersion
Get the runtime version of Qt being used. - qPrintable
Converts a QString to a const char* instead of writing QString.toLocal8Bit().constData(). Very useful - I could of done with this the other day when outputting some debug strings using... - qDebug
Write to the debug window, in std::iostream style, e.g.:
qDebug() << "String contents: " << qPrintable(myString); - QObject::deleteLater()
This is used to force an object to delete itself (delete this) when a signal occurs. I have used this to delete a QTcpSocket object automatically when the socket is disconnected.
There are lots more if you follow the link.
*waves*
ReplyDeleteHave you played with Creator 2.0b yet? They've made some nice addition and have even fixed *some* of the bugs I've raised.
They are getting there, even if each bug/missing functionality fix costs two new useless features.
I'm planning a 2.0 beta post at some point. Just started using it today.
ReplyDeleteBTW your description of deleteLater is incorrect. It simply defers deletion of a pointer (which may or may not be a QObject) until the start of the next iteration.
ReplyDeleteThis is important because Qt will sometimes try to access objects after you have deleted them. So you defer their deletion.
Whether or not you use deleteLater in response to a signal or not is irrelevant.
@Danny. Cheers for the deleteLater clarification. I assumed it was forcing Qt to somehow tidy up an object on your behalf.
ReplyDeleteSorry I mean to say 'next iteration of the event loop'.
ReplyDelete