Posted by Shantanu Sharma
Hii friends, this time i am going to share my little knowledge about Qt… i.e.. what is Qt, why it is used, and (obviously) how it is used 😛 Later on, in the successive blogs, I will show how to write applications in Qt.
Qt is basically a cross-platform c++ based application framework. Cross-
platform means that the code you write on one platform (ex. Linux) can get compiled easily on another platform (ex. Linux). Qt is mainly used for designing GUI (graphical user interface ) applications and some non-GUI application like console for servers. Qt finds its application in VLC media player, AutoDesk Maya, Fedora(KDE framework), Mathematica, OPERA MINI (upto version 10.0). The companies using Qt comprises of NOKIA, Samsung, Google (google server consoles), Research In Motion etc.
It is developed by a company called TrollTech. And one of the great things about Qt is the “dual licensing” i.e.. to use it either commercial or open source. Being commercial, you have to pay TrollTech the fees that are announced on their website. And if you are open source they won’t ask you about any money.
Qt is written in C++, but there are bindings for many other languages such as C, Python, C#, etc. It is fully object orientated and can be considered to be event driven. So it is advisable to have a little knowledge of C++ specific things like classes, member functions, constructors, destructors, OOPS feature, polymorphism, inheritance etc. Event Driven programming is like whenever the user generate any action in the application like clicking the command button, entering text, an event handler is coded (if needed) , which specifies the set of actions to happen. Generating the Stimuli is known as SIGNAL and the event handler or the response of the application is called SLOT. We will get in its details in the programming part. That means, whenever Qt makes use of internal code generator MOC (meta object compiler) to enrich the language by different macros and handy tools such as signals and slots mechanism 🙂
To understand MOC, First of all, we should know what is Signals and Slots(S&S). S&S mechanism is just like specifying some action for events happening inside the program. Some of you might be familiar with the Event Driven feature of Visual BASIC. Let us take an example of Command Button. The signals, this object can emit are shown here. Corresponding to every signal, we can associate any other object or action to this signal. like the form get closed after clicking the CMD button.
This feature of interconnection of two different objects is provided by MOC. 🙂 MOC internally generates the code for this connection.
Now to download Qt,
1> Go to http://qt-project.org/downloads
2> Choose the type you want to download.(i prefer offline installer mode)
3> If it is already an executable file, den simply run it and installer wizard will come. Else, change its mode to execution. Chmod +x myfilename
The whole IDE looks like this:
Qt contains different tools as you can see which make the RAPID building of application possible. The Same thing can be acheived with codes also but that is a tedious and BORING task. 😛
The best thing is that we can compile this file for numerous platforms like Windows (vista, 7 etc..), Symbian OS, Embedded linux, Linux etc… This cross compilation will obviously need those tools earlier used (refer to previous blogs on cross-compilation). But this is not that easy too. we hope to bring you the crosscompilation from x86 host to ARM target boards after development of some really handy applications 🙂
The books to be followed for QT are :
- Foundation of QT development by Johan Thelin
- The book of QT 4 by Daniel Molkentin
- c gui programming with qt 4-1st ed by Jasmin Blanchette & Mark Summerfield // my preference
About Shantanu SharmaCurrently working as Software R&D member in Samsung R&D India.
Posted on September 27, 2012, in Qt: The Face Of Embedded and tagged arch, C, embedded systems, Event-Driven, GUI, IDE, KDE, MOC, Nokia, OOPS, Qt, Qt books, Qt-creator, Signals & SLots, Trolltech, vlc. Bookmark the permalink. Leave a comment.