Wednesday, December 16, 2009

Qt Solutions, please help yourself

Are you aware that Nokia has launched Qt Solutions? Please refer to the Qt Solutions Catalog and you'll be surprised about the components and tools available there that can be used along Qt just to improve and enhance the cross-platform applications you develop.

My first contribution to Qt

And it finally happened! I've just sent my first code contribution to the Qt open repository. Now I'm waiting for them to approve (or eventually reject, you never know) my submission which is based on the code I presented in a previous blog.

Tuesday, November 24, 2009

Persistent logging (for debug purposes)

Many of us, Qt developers, resort to qDebug() (and the companion qWarning(), qCritical() and qFatal() functions) to write out debugging and tracing information along the flow of our application.

Most of the time, it's just a question of sending the desired message (a QtMsgType value) to the output stream provided by qDebug():
qDebug() << "Date: " << QDate::currentDate();
Moreover, the streaming operator << can be extended to provide support for custom types, for instance:
QDebug operator<<(QDebug dbg, const Circle &c)
{
    dbg.nospace() << "Radius: " << c.radius();
    return dbg.space();
}

Make it persistent
What if we need to get a copy of all the debug messages thrown by the application during a debugging session?

Thursday, October 8, 2009

Interesting testing

QTestLib is a framework provided by Nokia to create unit tests for applications developed using Qt.

It's a lightweight library, with several features like test initialization and cleanup, benchmarking and data driven testing. One thing it provides I found very useful it's the ability to simulate GUI events, both clicking a sequence of keys or generating mouse events (clicking, double clicking, moving) .

Thursday, September 17, 2009

Coding style template for Qt Eclipse Integration

While reading a recent post in Qt Labs Blogs regarding the S60 branch, they mentioned the code style, and specifically a Qt_Code_Style.xml template for using with the Carbide IDE. As it turns out, Carbide is Eclipse-based, so I decided to download and give it a try as I develop Qt apps using Eclipse + CDT + Qt Eclipse Integration.

I'm really happy that now I can comply with the Qt coding style easier, with assistance from the IDE itself.

To install the template, just from within Eclipse click Window > Preferences... > C/C++ > Code Style and import the file you just downloaded.

Wednesday, August 12, 2009

New name and domain (again)

Nokia has just changed the name and domain for Qt, once more.

Originally Trolltech (and trolltech.com), they changed that into Qt Software (and qtsoftware.com) after Nokia acquired Trolltech and they anounced a new change yesterday. Qt Software is now Qt Development Frameworks and the new domain is http://qt.nokia.com

I hope this is the last change. It's not good for us going changing e-mail address and links so frequently.

Don't do that! you have been warned...

It turned out that for some project running on Windows, the client asked for statically linking the C runtime (for some reasons I'm not going to disclose) both for Qt and for the application we were developing.

Although this way of build Qt is explicitly regretted by Qt Software (see here), we went that way anyhow. Everything went OK except that we found a memory issue when working in debug mode.

It turned out that some strange is surfacing when using stylesheets (in this case, via a .qss file embedded in the resource file).

So far we found no solution to this. Reverting to dynamically linking Qt means having to distribute and install the Visual C++ 2005 Redistributable Package which is not an option now. And if we statically link Qt (this way no .dlls) that we have proven indeed solved the problem, we cannot do that because of the restrictions of the LGPL license we chose for using Qt within this project.