Programming with Qt: Writing Portable GUI applications on Unix and Win32 [NOOK Book]


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 ...

See more details below
Programming with Qt: Writing Portable GUI applications on Unix and Win32

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99 price
(Save 44%)$35.99 List Price


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.

Read More Show Less

Editorial Reviews

Lou Grinzo

Linux's meteoric rise in both popularity and usage is increasing the demand for solid information for programmers about all aspects of Linux development, as well as cross-platform issues. Programming with Qt, by Matthias Dalheimer, covers a tool that addresses some of the thornier topics in modern GUI programming, cross-platform application frameworks, and widget toolkits. Qt is a product of Troll Tech, and is available for both X Windows and Win32 environments. Dalheimer is a member of the board of directors of the KDE Foundation, and has considerable Qt experience, since the KDE desktop environment for Linux is based on Qt.

In the book's 25 chapters, Dalheimer provides a good overview of the Qt programming model, and presents a solid conceptual framework for any experienced programmer new to Qt. He includes several usage tips and many pieces of thoughtful advice, any one of which could easily be worth the cost of the book in the right circumstances. He also talks about some more advanced topics, such as how to deal with resizable dialogs, especially at a time when large monitors are nearly ubiquitous; portability issues; and even the pros and cons of various approaches to writing a cross-platform widget toolkit like Qt. For readers new to Qt, especially those with a Windows background, this is all useful and enlightening material.

Dalheimer takes you through the expected steps, from the obligatory "Hello, world!" program to dealing with menus, event handling, Qt's layout managers and container classes, graphics and text programming, file handling, focus issues, and interapplication communication. One of the longer chapters covers writing your own Qt widgets, and includes two extended examples that will be useful references for anyone taking on this task. Chapter 9 is one of the strongest parts of the book, in that it covers numerous graphics programming topics, such as palette management, saving and displaying graphics, double buffering, and transformations.

One area the author focuses on throughout the book, and to good effect, is Qt's use of signals and slots. (These are not traditional UNIX IPC signals, but a variation unique to Qt.) This is the technology that notifies specific parts of a program when UI events happen, such as users clicking on a button or an item in a listbox. Every application framework has its own way of performing this "plumbing," and understanding it well enough to get notifications in the right places, forward them effectively, and so on, is critical to using the framework. Dalheimer clearly appreciates this fact, and doesn't just talk about Qt's signals and slots once and then move on, but returns to the topic several times in different contexts.

Experienced programmers might raise an eyebrow over the thought of covering all this material -- an entire application framework and a widget toolkit -- in a mere 361 pages. (Petzold's Programming Windows, easily the standard in this area, is well over twice the page count in its second edition, for example, even if it does cover some topics not in Qt.) This highlights the only serious problem with this book: Its treatment of some topics is conspicuously thin. For example, the discussion of the file open/save dialogs is barely half a page of text (not counting illustrations), yet you will likely spend considerable time with these dialogs in various programs, using them in different ways. This book isn't meant to be a replacement for Troll Tech's reference manual, obviously, but several examples of how to use these dialogs with various options (multiple selection, file must exist, and the like), as well as a discussion of cross-platform issues would have been very welcome. Similarly, there are places where Dalheimer leaves pertinent questions unanswered, such as what the limit is on the number of items that a Qt listbox will handle. (He does advise against putting too many items into a listbox, for human factors reasons, which is clearly good advice, but it's critical for programmers to know what such limits are if they're to avoid exceeding them.)

I was bothered by the number of extremely short chapters. Chapter 13, "Working with Date and Time Values" is less than one page of text, Chapter 18, "Debugging" is not quite two full pages, and "Sample Qt Projects" mentions only two -- KDE and Ortho Vista -- and doesn't provide nearly the insight into real-world usage of Qt for commercial work that I'd hoped for. More serious yet is the book's almost complete avoidance of font and text output issues, something nearly all programmers will have to wrestle with.

These problems certainly don't make this a bad book, but they do make me wish for at least a few hundred more pages of the kind of work that Dalheimer is clearly capable of, to provide the fuller treatment programmers need of Qt at this time. Still, Programming with Qt, combined with the Qt reference material (freely available from the Troll Tech web site), should be enough to get experienced programmers started, while we hold out hope for a more comprehensive second edition.
Electronic Review of Books

Read More Show Less

Product Details

  • ISBN-13: 9781449390938
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/22/2002
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 522
  • File size: 5 MB

Meet 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.

Read More Show Less

Table of Contents

1 Introduction 1
2 First Steps in Qt Programming 19
3 Learning More About Qt 45
4 A Guided Tour Through the Simple Widgets 81
5 A Guided Tour Through the Qt Dialog Boxes 134
6 Using Layout Managers 155
7 Some Thoughts on GUI Design 167
8 Container Classes 173
9 Graphics 184
10 Text Processing 219
11 Working with Files and Directories 248
12 Interapplication Communication 258
13 Interfacing with the Operating System 265
14 Writing Your Own Widgets 274
15 Focus Handling 299
16 Advanced Event Handling 302
17 Advanced Signals and Slots 306
18 Providing Help 313
19 Accessing Databases 317
20 Multithreading 343
21 Debugging 350
22 Portability 353
23 Qt Network Programming 365
24 Interfacing Qt with Other Languages and Libraries 375
25 Using the Visual C++ IDE for Qt Programs 397
26 Visual Design with Qt Designer 400
App.: Answers to Exercises 455
Bibliography 477
Index 479
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)