180 likes | 335 Views
Nitish Jaisoor. Introduction to Qt Programming. Agenda. The need for GUI programming Why Qt? Introduction to the Qt GUI toolkit What's involved in GUI design Part 1 – Widgets & the visible stuff Part 2 – Signals & the hidden stuff Part 3 – Code snippets References Q&A.
E N D
Nitish Jaisoor Introduction to Qt Programming
Agenda • The need for GUI programming • Why Qt? • Introduction to the Qt GUI toolkit • What's involved in GUI design • Part 1 – Widgets & the visible stuff • Part 2 – Signals & the hidden stuff • Part 3 – Code snippets • References • Q&A
The need for GUI programming • The need to present all the options available to the user in an easy, pleasing style • Front ends to console based applications can make them easier to use • Linux newbies find GUIs very user friendly • Pictorial presentation of data is possible
Why Qt? • Some common toolkits: GTK+, Qt, Tk, Visual Studio IDE. • Licensing issues • Cross platform portability • Object oriented design • Development language – C or C++? • Ease of learning • Well structured documentation
Introduction to the Qt GUI toolkit • Developed by Trolltech AS • Based on OO C++ • Available for Linux, Win32, Mac OsX, Embedded • Basic C++ knowledge required • Qt Object model • Applications developed using Qt • Reference documentation • Useful tools – QtDesigner, qmake
What's involved in GUI design • Obtain the requirements • List out the functionality required • Map the functionality to a GUI element • Group similar functional elements • Plan a user friendly layout • User friendliness: Error messages, Help dialogs • Connect the functions and GUI elements
Part-1: Widgets & the visible stuff • A user interface object that can process user input and draw graphics • Properties of a widget • Types of widgets • Parent and child widgets
Part 1 (cont.): Parents and children Main Widget (QWidget) Button 1 (QPushButton) Label (QLabel) Button 2 (QPushButton)
Part 2: Signals & the hidden stuff • Signals and Slots provide an effective means of communication between objects • They provide the “functionality” to the widget element while hiding the actual processing Object 1 Signal 1 Signal 2 Object 2 Signal 1 Slot 1 Slot 1 Slot 2
Part 2 (cont.): Signals and Slots Slot displayMessage() MessageLabel-> setText(“Welcome!”) Signal clicked() Slot qApp->quit() Signal clicked()
Part 2 (cont.): Events and stuff • Events are delivered to objects when a certain event takes place • Strong support for events like mouse events, timer events, etc. • Timers enable the scheduling of events in an object
Part 3: Code snippets • A simple widget • A widget with a label and 2 buttons • The above with signals and slots • A small timer application
References • The Qt documentation – with the distribution or at http://www.trolltech.com • Programming with Qt – Matthias Kalle Dalheimer (O'Reilly) • OSS code – get them at sites like http://apps.kde.com
Q&A • Contact information: nitish_jaisoor@infosys.com