You are previewing C++ GUI Programming with Qt 4.
O'Reilly logo
C++ GUI Programming with Qt 4

Book Description

The Only Official, Best-Practice Guide to Qt 4.3 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 source code changes. Now, two Trolltech insiders have written a start-to-finish guide to getting outstanding results with the latest version of Qt: Qt 4.3.

Packed with realistic examples and in-depth advice, this is the book Trolltech uses to teach Qt to its own new hires. Extensively revised and expanded, it reveals today's best Qt programming patterns for everything from implementing model/view architecture to using Qt 4.3's improved graphics support. You'll find proven solutions for virtually every GUI development task, as well as sophisticated techniques for providing database access, integrating XML, using subclassing, composition, and more. Whether you're new to Qt or upgrading from an older version, this book can help you accomplish everything that Qt 4.3 makes possible.

  • Completely updated throughout, with significant new coverage of databases, XML, and Qtopia embedded programming

  • Covers all Qt 4.2/4.3 changes, including Windows Vista support, native CSS support for widget styling, and SVG file generation

  • Contains separate 2D and 3D chapters, coverage of Qt 4.3's new graphics view classes, and an introduction to QPainter's OpenGL back-end

  • Includes new chapters on look-and-feel customization and application scripting

  • Illustrates Qt 4's model/view architecture, plugin support, layout management, event processing, container classes, and much more

  • Presents advanced techniques covered in no other book—from creating plugins to interfacing with native APIs

  • Includes a new appendix on Qt Jambi, the new Java version of Qt

  • Table of Contents

    1. Copyright
    2. Series Editor’s Note
    3. Foreword
    4. Preface
    5. Acknowledgments
    6. A Brief History of Qt
    7. I. 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
    8. II. Intermediate Qt
      1. 6. Layout Management
        1. Laying Out Widgets on a Form
        2. Stacked Layouts
        3. Splitters
        4. Scrolling Areas
        5. Dock Windows 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 Graphics
        1. Painting with QPainter
        2. Coordinate System Transformations
        3. High-Quality Rendering with QImage
        4. Item-Based Rendering with Graphics View
        5. Printing
      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. Viewing Tables
        3. Editing Records Using Forms
        4. Presenting Data in Tabular Forms
      9. 14. Multithreading
        1. Creating Threads
        2. Synchronizing Threads
        3. Communicating with the Main Thread
        4. Using Qt’s Classes in Secondary Threads
      10. 15. Networking
        1. Writing FTP Clients
        2. Writing HTTP Clients
        3. Writing TCP Client–Server Applications
        4. Sending and Receiving UDP Datagrams
      11. 16. XML
        1. Reading XML with QXmlStreamReader
        2. Reading XML with DOM
        3. Reading XML with SAX
        4. Writing XML
      12. 17. Providing Online Help
        1. Tooltips, Status Tips, and “What’s This?” Help
        2. Using a Web Browser to Provide Online Help
        3. Using QTextBrowser as a Simple Help Engine
        4. Using Qt Assistant for Powerful Online Help
    9. III. Advanced Qt
      1. 18. Internationalization
        1. Working with Unicode
        2. Making Applications Translation-Aware
        3. Dynamic Language Switching
        4. Translating Applications
      2. 19. Look and Feel Customization
        1. Using Qt Style Sheets
        2. Subclassing QStyle
      3. 20. 3D Graphics
        1. Drawing Using OpenGL
        2. Combining OpenGL and QPainter
        3. Doing Overlays Using Framebuffer Objects
      4. 21. Creating Plugins
        1. Extending Qt with Plugins
        2. Making Applications Plugin-Aware
        3. Writing Application Plugins
      5. 22. Application Scripting
        1. Overview of the ECMAScript Language
        2. Extending Qt Applications with Scripts
        3. Implementing GUI Extensions Using Scripts
        4. Automating Tasks through Scripting
      6. 23. Platform-Specific Features
        1. Interfacing with Native APIs
        2. Using ActiveX on Windows
        3. Handling X11 Session Management
      7. 24. Embedded Programming
        1. Getting Started with Qt/Embedded Linux
        2. Customizing Qt/Embedded Linux
        3. Integrating Qt Applications with Qtopia
        4. Using Qtopia APIs
    10. IV. Appendixes
      1. A. Obtaining and Installing Qt
        1. A Note on Licensing
        2. Installing Qt/Windows
        3. Installing Qt/Mac
        4. Installing Qt/X11
      2. B. Building Qt Applications
        1. Using qmake
        2. Using Third-Party Build Tools
          1. CMake: Cross-Platform Make
          2. Boost.Build (bjam)
          3. SCons: Software Construction Tool
      3. C. Introduction to Qt Jambi
        1. Getting Started with Qt Jambi
        2. Using Qt Jambi in the Eclipse IDE
        3. Integrating C++ Components with Qt Jambi
      4. D. 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
      5. About the Authors
        1. Jasmin Blanchette
        2. Mark Summerfield
      6. Production