180 likes | 353 Vues
This presentation explores the need for GUI programming and the advantages of using Qt. It covers the basics of the Qt GUI toolkit, including widget types, signals and slots for object communication, and essential design practices for user-friendly interfaces. Learn how to create appealing front-ends for applications across various platforms. The session will feature code snippets and practical examples to illustrate key concepts, alongside references for further learning. Finally, a Q&A session will address any queries related to Qt programming.
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