QT Learning blues

A few weeks ago (with birthday money from my mum & dad) I bought Matthias Kalle Dalheimer’s book, “Programming with Qt” (published by O’Reilly) - Qt is a graphical user interface toolkit mostly used on Linux but you can also get it for Windoze, Mac and embedded systems also. It presents an extremely steep learning curve, and in the first chapter of ‘serious’ programming basically expects you to go off and learn whole areas of Qt programming by yourself. I ended up just looking at the answers, although perhaps if I’d had more time I’d have been able to work it out by myself. In chapter four, he tells you how to set the widget style for the whole application, giving you a whole chunk of code without telling you where to put it in your program. I tried putting this into my main() function:

QApplication::setStyle( new QMotifStyle );

And this gave me a “parse error” when I compiled it, which seemed odd because that’s exactly what he said to type (OK, he said “QWindowsStyle”, but QMotifStyle is valid if you want Motif style). He forgot to mention that you need a special header file for whatever new style you want to use. I ended up putting this into main():

myapp.setStyle( new QMotifStyle );

With the header file I mentioned, it worked.

Possibly Related Posts: