Programming with Qt: Writing Portable GUI applications on Unix and Win32

Programming with Qt: Writing Portable GUI applications on Unix and Win32

by Matthias Kalle Dalheimer
Programming with Qt: Writing Portable GUI applications on Unix and Win32

Programming with Qt: Writing Portable GUI applications on Unix and Win32

by Matthias Kalle Dalheimer

eBook

$26.99  $35.99 Save 25% Current price is $26.99, Original price is $35.99. You Save 25%.

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

The popular open source KDE desktop environment for Unix was built with Qt, a C++ class library for writing GUI applications that run on Unix, Linux, Windows 95/98, Windows 2000, and Windows NT platforms. Qt emulates the look and feel of Motif, but is much easier to use. Best of all, after you have written an application with Qt, all you have to do is recompile it to have a version that works on Windows. Qt also emulates the look and feel of Windows, so your users get native-looking interfaces.Platform independence is not the only benefit. Qt is flexible and highly optimized. You'll find that you need to write very little, if any, platform-dependent code because Qt already has what you need. And Qt is free for open source and Linux development.Although programming with Qt is straightforward and feels natural once you get the hang of it, the learning curve can be steep. Qt comes with excellent reference documentation, but beginners often find the included tutorial is not enough to really get started with Qt. That's whereProgramming with Qt steps in. You'll learn how to program in Qt as the book guides you through the steps of writing a simple paint application. Exercises with fully worked out answers help you deepen your understanding of the topics. The book presents all of the GUI elements in Qt, along with advice about when and how to use them, so you can make full use of the toolkit. For seasoned Qt programmers, there's also lots of information on advanced 2D transformations, drag-and-drop, writing custom image file filters, networking with the new Qt Network Extension, XML processing, Unicode handling, and more.Programming with Qt helps you get the most out of this powerful, easy-to-use, cross-platform toolkit. It's been completely updated for Qt Version 3.0 and includes entirely new information on rich text, Unicode/double byte characters, internationalization, and network programming.


Product Details

ISBN-13: 9781449390938
Publisher: O'Reilly Media, Incorporated
Publication date: 01/22/2002
Sold by: Barnes & Noble
Format: eBook
Pages: 522
File size: 4 MB

About the Author

Matthias Kalle Dalheimer is the President & CEO of Klaralvdalens Datakonsult AB, a Sweden-based consultancy specializing in platform-independent software solutions. He is also a founding member of the KDE project and the current president of the KDE foundation. Kalle has written numerous books for O'Reilly, both in English and in his native German, including "Running Linux" and "Programming with Qt". In his spare time, he enjoys cross-country skiing and reading history books. Kalle lives with his wife Tanja and his two sons Jan and Tim in the middle of the forest near Hagfors in the Swedish province of Varmland.

Table of Contents

Prefacexi
1.Introduction1
Why GUI Toolkits?1
Why Portability?3
Why Qt?3
Implementing Cross-Platform GUI Libraries4
Acquiring Qt6
Compiling and Installing Qt8
C++ as Used by Qt16
Getting Help17
2.First Steps in Qt Programming19
Hello, world!19
Using the Qt Reference Documentation23
Adding an Exit Button26
Introduction to Signals and Slots28
Event Handling and Simple Drawings with QPainter37
3.Learning More About Qt45
Adding Menus45
Adding a Scrolled View55
Adding a Context Menu63
File I/O71
4.A Guided Tour Through the Simple Widgets81
General Widget Parameters85
Widget Styles86
Buttons88
Selection Widgets91
Widgets for Bounded-Range Input95
Scrollbars100
Menu-Related Widgets102
Arrangers103
Tab-Related Widgets108
Text-Entry Fields108
Labels110
Widgets for the Office113
Progress Bars120
Scrolled Views121
List Views122
Icon Views128
Widgets for Tabular Material129
Widgets for Displaying Rich Text132
5.A Guided Tour Through the Qt Dialog Boxes134
Predfined Dialog Boxes134
Building Blocks for Your Own Dialog Boxes145
6.Using Layout Managers155
Layout Manager Basics155
Laying Out Widgets in Rows and Columns157
Nested Layout Managers160
Grid Layout162
Implicit Geometry Management164
7.Some Thoughts on GUI Design167
8.Container Classes173
Available Container Classes174
Choosing a Container Class176
Working with Reference-Based Container Classes177
Working with Value-Based Container Classes181
9.Graphics184
Animations184
Printing186
Managing Colors191
Basic QPainter: Drawing Figures196
Advanced QPainter198
Double-Buffering and Other Nifty Techniques203
Independently Movable Objects with QCanvas208
Working with Styles213
Loading and Saving Custom Image Formats215
Setting a Cursor218
10.Text Processing219
Internationalization and Localization of On-Screen Text219
Validating User Input227
Working with Regular Expressions232
Reading and Writing XML Files237
Rich Text245
11.Working with Files and Directories248
Reading a Text File248
Traversing a Directory251
File Information253
Reading and Writing Configuration Data254
12.Interapplication Communication258
Using the Clipboard258
Drag-and-Drop259
13.Interfacing with the Operating System265
Working with Date and Time Values265
Loading Code Libraries Dynamically266
Spawning Child Processes269
Playing Sounds271
14.Writing Your Own Widgets274
Implementing a Coordinate Selector276
Implementing a Browse Box285
15.Focus Handling299
16.Advanced Event Handling302
Event Filters302
Sending Synthetic Events304
17.Advanced Signals and Slots306
Signals and Slots Revisited306
Connecting Several Buttons to One Slot309
Actions310
18.Providing Help313
19.Accessing Databases317
Installation of the SQL Module319
Connecting to a Database320
Simple Data Retrieval322
Data Retrieval with Cursors325
Data Display328
Data Manipulation337
Anything Else?341
20.Multithreading343
Configuring Qt for Multithreading344
Using Qt's Multithreading Classes344
Multithreading Pitfalls348
Alternatives to Multithreading348
21.Debugging350
22.Portability353
Why Portability Is Desirable353
How to Write Portable Programs355
Danger Ahead: When Even Qt Is Not Portable356
Building Projects Portably with qmake360
23.Qt Network Programming365
Low-Level Socket Access365
Higher-Level Network Access370
24.Interfacing Qt with Other Languages and Libraries375
OpenGL Programming with Qt375
Writing Netscape Plug-ins379
Integrating Xt Widgets387
Interfacing Qt with Perl389
25.Using the Visual C++ IDE for Qt Programs397
Importing an Existing Makefile397
Creating Your Own Project from Scratch398
Using qmake to Create a Project File399
Using the MS Visual Studio Integration399
26.Visual Design with Qt Designer400
Why Do You Need A GUI Designer?400
Creating a Simple Application with the Help of Qt Designer401
Adding Functionality to a Dialog Box by Subclassing418
Using Layout Management427
Useful Techniques436
AppendixAnswers to Exercises455
Bibliography477
Index479
From the B&N Reads Blog

Customer Reviews