Qt5 C++ GUI Programming Cookbook - Second Edition

Book Description

Use Qt 5 to design and build functional, appealing, and user-friendly graphical user interfaces (GUIs) for your applications.

Key Features

  • Learn to use Qt 5 to design and customize the look and feel of your application
  • Improve the visual quality of an application by using graphics rendering and animation
  • Understand the balance of presentation and web content that will make an application appealing yet functional

Book Description

With the growing need to develop GUIs for multiple targets and multiple screens, improving the visual quality of your application becomes important so that it stands out from your competitors. With its cross-platform ability and the latest UI paradigms, Qt makes it possible to build intuitive, interactive, and user-friendly user interfaces for your applications.

Qt5 C++ GUI Programming Cookbook, Second Edition teaches you how to develop functional and appealing user interfaces using the latest version of QT5 and C++. This book will help you learn a variety of topics such as GUI customization and animation, graphics rendering, implementing Google Maps, and more. You will also be taken through advanced concepts like asynchronous programming, event handling using signals and slots, network programming, various aspects of optimizing your application.

By the end of the book, you will be confident to design and customize GUI applications that meet your clients' expectations and have an understanding of best practice solutions for common problems.

What you will learn

  • Animate GUI elements using Qt5's built-in animation system
  • Draw shapes and 2D images using Qt5's powerful rendering system
  • Implement an industry-standard OpenGL library in your project
  • Build a mobile app that supports touch events and exports it onto devices
  • Parse and extract data from an XML file and present it on your GUI
  • Interact with web content by calling JavaScript functions from C++
  • Access MySQL and SQLite databases to retrieve data and display it on your GUI

Who this book is for

This intermediate-level book is designed for those who want to develop software using Qt 5. If you want to improve the visual quality and content presentation of your software application, this book is for you. Prior experience of C++ programming is required.

Publisher Resources

Download Example Code

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Qt5 C++ GUI Programming Cookbook Second Edition
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in Action
      4. Conventions used
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Get in touch
      1. Reviews
  6. Look-and-Feel Customization with Qt Designer
    1. Introduction
    2. Technical requirements
    3. Using style sheets with Qt Designer
      1. How to do it…
      2. How it works...
      3. There's more…
    4. Customizing basic style sheets
      1. How to do it…
      2. How it works...
    5. Creating a login screen using style sheets
      1. How to do it…
      2. How it works...
    6. Using resources in style sheets
      1. How to do it
      2. How it works...
    7. Customizing properties and sub-controls
      1. How to do it…
      2. How it works...
    8. Styling in Qt Modeling Language (QML)
      1. How to do it…
      2. How it works...
    9. Exposing the QML object pointer to C++
      1. How to do it…
      2. How it works...
  7. Event Handling - Signals and Slots
    1. Introduction
    2. Technical requirements
    3. New signals and slots syntax
      1. How to do it...
      2. How it works...
    4. UI events with signals and slots
      1. How to do it...
      2. How it works...
    5. Asynchronous programming made easier
      1. How to do it...
      2. How it works...
    6. Function callbacks
      1. How to do it...
      2. How it works...
  8. States and Animations with Qt and QML
    1. Introduction
    2. Technical requirements
    3. Property animation in Qt
      1. How to do it…
      2. How it works...
      3. There's more…
    4. Using easing curves to control property animation
      1. How to do it…
      2. How it works...
      3. There's more…
    5. Creating an animation group
      1. How to do it…
      2. How it works...
      3. There's more…
    6. Creating a nested animation group
      1. How to do it…
      2. How it works...
    7. State machines in Qt
      1. How to do it…
      2. How it works...
      3. There's more…
    8. States, transitions, and animations in QML
      1. How to do it…
      2. How it works...
      3. There's more…
    9. Animating widget properties using animators
      1. How to do it…
      2. How it works...
    10. Sprite animation
      1. How to do it…
      2. How it works...
      3. There's more…
  9. QPainter and 2D Graphics
    1. Introduction
    2. Technical requirements
    3. Drawing basic shapes onscreen
      1. How to do it…
      2. How it works...
      3. There's more…
    4. Exporting shapes to SVG files
      1. How to do it…
      2. How it works...
      3. There's more…
    5. Coordinate transformation
      1. How to do it…
      2. How it works...
      3. There's more…
    6. Displaying images onscreen
      1. How to do it…
      2. How it works...
      3. There's more…
    7. Applying image effects to graphics
      1. How to do it…
      2. How it works...
      3. There's more…
    8. Creating a basic paint program
      1. How to do it…
      2. How it works...
    9. Rendering a 2D canvas in QML
      1. How to do it…
  10. OpenGL Implementation
    1. Introduction
    2. Technical requirements
    3. Setting up OpenGL in Qt
      1. How to do it…
      2. How it works...
      3. There's more…
    4. Hello World!
      1. How to do it…
      2. How it works...
    5. Rendering 2D shapes
      1. How to do it…
      2. How it works...
    6. Rendering 3D shapes
      1. How to do it...
      2. How it works...
    7. Texturing in OpenGL
      1. How to do it…
      2. How it works...
    8. Basic lighting in OpenGL
      1. How to do it…
      2. How it works...
    9. Moving an object using keyboard controls
      1. How to do it…
      2. How it works...
    10. 3D canvas in QML
      1. How to do it…
      2. How it works...
  11. Using Network and Managing Large Documents
    1. Introduction
    2. Technical requirements
    3. Creating a TCP server
      1. How to do it…
      2. How it works...
    4. Creating a TCP client
      1. How to do it...
      2. How it works...
    5. Uploading and downloading files using FTP 
      1. How to do it...
      2. How it works...
  12. Threading Basics - Asynchronous Programming
    1. Introduction
    2. Technical requirements
    3. Using threads
      1. How to do it…
      2. How it works...
    4. QObject and QThread
      1. How to do it…
      2. How it works...
    5. Data protection and sharing data between threads
      1. How to do it…
      2. How it works...
    6. Working with QRunnable processes
      1. How to do it…
      2. How it works...
  13. Building a Touch Screen Application with Qt5
    1. Introduction
    2. Technical requirements
    3. Setting up Qt for mobile applications
      1. How to do it…
      2. How it works…
    4. Designing a basic user interface with QML
      1. How to do it…
      2. How it works…
    5. Touch events
      1. How to do it…
      2. How it works…
      3. There's more…
    6. Animation in QML
      1. How to do it…
      2. How it works…
    7. Displaying information using model/view
      1. How to do it…
      2. How it works…
    8. Integrating QML and C++
      1. How to do it…
      2. How it works…
  14. XML Parsing Made Easy
    1. Technical requirements
    2. Processing XML data using the stream reader
      1. How to do it…
      2. How it works…
      3. There's more…
    3. Writing XML data using the Stream Writer
      1. How to do it…
      2. How it works…
    4. Processing XML data using the QDomDocument class
      1. How to do it…
      2. How it works…
    5. Writing XML data using the QDomDocument class
      1. How to do it…
      2. How it works…
    6. Using Google's Geocoding API
      1. How to do it…
      2. How it works…
      3. There's more…
  15. Conversion Library
    1. Introduction
    2. Technical requirements
    3. Converting data
      1. How to do it…
      2. How it works...
      3. There's more…
    4. Converting images
      1. How to do it…
      2. How it works...
      3. There's more…
    5. Converting videos
      1. How to do it…
      2. How it works...
      3. There's more…
    6. Converting currency
      1. How to do it…
      2. How it works...
      3. There's more…
  16. Accessing Databases with SQL Driver and Qt
    1. Introduction
    2. Technical requirements
    3. Setting up a database
      1. How to do it…
      2. How it works…
    4. Connecting to a database
      1. How to do it…
      2. How it works…
    5. Writing basic SQL queries
      1. How to do it…
      2. How it works…
    6. Creating a login screen with Qt
      1. How to do it…
      2. How it works…
    7. Displaying information from a database on a model view
      1. How to do it…
      2. How it works…
    8. Advanced SQL queries
      1. How to do it…
      2. How it works…
      3. There's more…
  17. Develop Web Applications using Qt WebEngine
    1. Introduction
    2. Technical requirements
    3. Introducing Qt WebEngine
      1. How to do it…
      2. How it works…
      3. There's more…
    4. Using WebView and web settings
      1. How to do it…
      2. How it works…
    5. Embedding Google Maps in your project
      1. How to do it…
      2. How it works…
    6. Calling C++ functions from JavaScript
      1. How to do it…
      2. How it works…
    7. Calling JavaScript functions from C++
      1. How to do it…
      2. How it works…
  18. Performance Optimization
    1. Introduction
    2. Technical requirements
    3. Optimizing form and C++
      1. How to do it...
      2. How it works...
    4. Profiling and optimizing QML
      1. How to do it...
      2. How it works...
    5. Rendering and animation
      1. How to do it...
      2. How it works...
  19. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product Information

  • Title: Qt5 C++ GUI Programming Cookbook - Second Edition
  • Author(s): Lee Zhi Eng
  • Release date: March 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789803822