O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C++ GUI Programming with Qt 4

Book Description

The Only Official Best-Practice Guide to Qt 4.1 Programming

Using Trolltech's Qt you can build industrial-strength C++ applications that run natively on Windows, Linux/Unix, Mac OS X, and embedded Linux--without making source code changes. With this book Trolltech insiders have written a start-to-finish guide to getting great results with the most powerful version of Qt ever created: Qt 4.1.

Using C++ GUI Programming with Qt 4 you'll discover the most effective Qt 4 programming patterns and techniques as you master key technologies ranging from Qt's model/view architecture to Qt's powerful new 2D paint engine. The authors provide readers with unparalleled insight into Qt's event model and layout system. Then, using realistic examples, they introduce superior techniques for everything from basic GUI development to advanced database and XML integration.

  • Includes new chapters on Qt 4's model/view architecture and Qt's new plugin support, along with a brief introduction to Qtopia embedded programming

  • Covers all Qt fundamentals, from dialogs and windows to implementing application functionality

  • Introduces best practices for layout management and event processing

  • Shows how to make the most of Qt 4's new APIs, including the powerful new 2D paint engine and the new easy-to-use container classes

  • Contains completely updated material in every chapter

  • Presents advanced Qt 4 techniques covered in no other book, from creating both Qt and application plugins to interfacing with native APIs

  • Contains an in-depth appendix on C++/Qt programming for experienced Java developers

  • The accompanying CD-ROM includes the open source edition of Qt 4.1.1 for Windows, Mac, Linux, and many Unixes, as well as MinGW, a set of freely available development tools that can be used to build Qt applications on Windows, and also the source code for the book's examples.

    Table of Contents

    1. Copyright
    2. Foreword
    3. Preface
    4. Acknowledgments
    5. A Brief History of Qt
    6. 1. Basic Qt
      1. 1. Getting Started
        1. Hello Qt
        2. Making Connections
        3. Laying Out Widgets
        4. Using the Reference Documentation
      2. 2. Creating Dialogs
        1. Subclassing QDialog
        2. Signals and Slots in Depth
        3. Rapid Dialog Design
        4. Shape-Changing Dialogs
        5. Dynamic Dialogs
        6. Built-in Widget and Dialog Classes
      3. 3. Creating Main Windows
        1. Subclassing QMainWindow
        2. Creating Menus and Toolbars
        3. Setting Up the Status Bar
        4. Implementing the File Menu
        5. Using Dialogs
        6. Storing Settings
        7. Multiple Documents
        8. Splash Screens
      4. 4. Implementing Application Functionality
        1. The Central Widget
        2. Subclassing QTableWidget
        3. Loading and Saving
        4. Implementing the Edit Menu
        5. Implementing the Other Menus
        6. Subclassing QTableWidgetItem
      5. 5. Creating Custom Widgets
        1. Customizing Qt Widgets
        2. Subclassing QWidget
        3. Integrating Custom Widgets with Qt Designer
        4. Double Buffering
    7. II. Intermediate Qt
      1. 6. Layout Management
        1. Laying Out Widgets on a Form
        2. Stacked Layouts
        3. Splitters
        4. Scrolling Areas
        5. Dock Widgets and Toolbars
        6. Multiple Document Interface
      2. 7. Event Processing
        1. Reimplementing Event Handlers
        2. Installing Event Filters
        3. Staying Responsive During Intensive Processing
      3. 8. 2D and 3D Graphics
        1. Painting with QPainter
        2. Painter Transformations
        3. High-Quality Rendering with QImage
        4. Printing
        5. Graphics with OpenGL
      4. 9. Drag and Drop
        1. Enabling Drag and Drop
        2. Supporting Custom Drag Types
        3. Clipboard Handling
      5. 10. Item View Classes
        1. Using the Item View Convenience Classes
        2. Using Predefined Models
        3. Implementing Custom Models
        4. Implementing Custom Delegates
      6. 11. Container Classes
        1. Sequential Containers
        2. Associative Containers
        3. Generic Algorithms
        4. Strings, Byte Arrays, and Variants
      7. 12. Input/Output
        1. Reading and Writing Binary Data
        2. Reading and Writing Text
        3. Traversing Directories
        4. Embedding Resources
        5. Inter-Process Communication
      8. 13. Databases
        1. Connecting and Querying
        2. Presenting Data in Tabular Form
        3. Implementing Master–Detail Forms
      9. 14. Networking
        1. Writing FTP Clients
        2. Writing HTTP Clients
        3. Writing TCP Client–Server Applications
        4. Sending and Receiving UDP Datagrams
      10. 15. XML
        1. Reading XML with SAX
        2. Reading XML with DOM
        3. Writing XML
      11. 16. Providing Online Help
        1. Tooltips, Status Tips, and “What’s This?” Help
        2. Using QTextBrowser as a Simple Help Engine
        3. Using Qt Assistant for Powerful Online Help
    8. III. Advanced Qt
      1. 17. Internationalization
        1. Working with Unicode
        2. Making Applications Translation-Aware
        3. Dynamic Language Switching
        4. Translating Applications
      2. 18. Multithreading
        1. Creating Threads
        2. Synchronizing Threads
        3. Communicating with the Main Thread
        4. Using Qt’s Classes in Secondary Threads
      3. 19. Creating Plugins
        1. Extending Qt with Plugins
        2. Making Applications Plugin-Aware
        3. Writing Application Plugins
      4. 20. Platform-Specific Features
        1. Interfacing with Native APIs
        2. Using ActiveX on Windows
        3. Handling X11 Session Management
      5. 21. Embedded Programming
        1. Getting Started with Qtopia
        2. Customizing Qtopia Core
    9. A. Installing Qt
      1. A Note on Licensing
      2. Installing Qt/Windows
      3. Installing Qt/Mac
      4. Installing Qt/X11
    10. B. Introduction to C++ for Java and C# Programmers
      1. Getting Started with C++
      2. Main Language Differences
        1. Primitive Data Types
        2. Class Definitions
        3. Pointers
        4. References
        5. Arrays
        6. Character Strings
        7. Enumerations
        8. Typedefs
        9. Type Conversions
        10. Operator Overloading
        11. Value Types
        12. Global Variables and Functions
        13. Namespaces
        14. The Preprocessor
      3. The Standard C++ Library
    11. About the Authors
    12. Production