Application Development with Qt Creator

Book description

Explore Qt Creator, Qt Quick, and QML to design and develop applications that work on desktop, mobile, embedded, and IoT platforms

Key Features

  • Build a solid foundation in Qt by learning about its core classes, multithreading, File I/O, and networking
  • Learn GUI programming and build custom interfaces using Qt Widgets, Qt Designer, and QML
  • Use the latest features of C++17 for improving the performance of your Qt applications

Book Description

Qt is a powerful development framework that serves as a complete toolset for building cross-platform applications, helping you reduce development time and improve productivity. Completely revised and updated to cover C++17 and the latest developments in Qt 5.12, this comprehensive guide is the third edition of Application Development with Qt Creator.

You'll start by designing a user interface using Qt Designer and learn how to instantiate custom messages, forms, and dialogues. You'll then understand Qt's support for multithreading, a key tool for making applications responsive, and the use of Qt's Model-View-Controller (MVC) to display data and content. As you advance, you'll learn to draw images on screen using Graphics View Framework and create custom widgets that interoperate with Qt Widgets. This Qt programming book takes you through Qt Creator's latest features, such as Qt Quick Controls 2, enhanced CMake support, a new graphical editor for SCXML, and a model editor. You'll even work with multimedia and sensors using Qt Quick, and finally develop applications for mobile, IoT, and embedded devices using Qt Creator.

By the end of this Qt book, you'll be able to create your own cross-platform applications from scratch using Qt Creator and the C++ programming language.

What you will learn

  • Create programs from scratch using the Qt framework and C++ language
  • Compile and debug your Qt Quick and C++ applications using Qt Creator
  • Implement map view with your Qt application and display device location on the map
  • Understand how to call Android and iOS native functions from Qt C++ code
  • Localize your application with Qt Linguist
  • Explore various Qt Quick components that provide access to audio and video playbacks
  • Develop GUI applications using both Qt and Qt Quick

Who this book is for

If you are a beginner looking to harness the power of Qt and the Qt Creator framework for cross-platform development, this book is for you. Although no prior knowledge of Qt and Qt Creator is required, basic knowledge of C++ programming is assumed.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Application Development with Qt Creator Third Edition
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the authors
    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. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: The Basics
  7. Getting Started with Qt Creator
    1. Technical requirements
    2. Downloading Qt and Qt Creator
    3. New features in Qt
    4. Finding your way around Qt Creator
    5. Your first application – Hello World
    6. Hello World using the Qt Widgets library
      1. Placing widgets in Qt Designer
    7. Hello World using Qt Quick
    8. Summary
  8. Building Applications with Qt Creator
    1. Technical requirements
    2. Getting started – our sample library
    3. Learning the landscape – the Build menu and the .pro file
    4. Linking against our sample library
    5. Getting lost and found again – debugging
      1. Setting breakpoints and stepping through your program
      2. Examining variables and memory
      3. Examining the call stack
    6. The Projects pane and building your project
    7. A review – running and debugging your application
    8. Summary
  9. Designing Your Application with Qt Designer
    1. Technical requirements
    2. Introducing signals and slots
    3. Creating user interfaces with Qt Designer
      1. Creating the main form
      2. Using application resources
    4. Instantiating forms, message boxes, and dialogs in your application
    5. Wiring the Qt Widgets application logic
      1. Learning more about Qt Widgets
    6. Introducing Qt Quick's support for declarative user interface development
    7. Understanding the building of a Qt application
    8. Creating the Qt application
      1. The calculator's main view
      2. Learning more about Qt Quick and QML
    9. Summary
  10. Qt Foundations
    1. Technical requirements
    2. Representing data using Qt's core classes
      1. Working with key-value pairs
    3. Multithreading in Qt
    4. Accessing files using Qt
    5. Accessing HTTP resources using Qt
      1. Performing HTTP requests
    6. Parsing XML using Qt
      1. Using XML parsing with HTTP
      2. Implementing WorkerThread
    7. Parsing JSON using Qt
    8. Summary
  11. Developing Applications with Qt Widgets
    1. Technical requirements
    2. Your main application and its menus
    3. Creating simple Qt Widgets
    4. Managing the widget layout with layouts
    5. Model-View-Controller programming with Qt
      1. Analyzing a concrete model subclass
      2. Using the MVC model on Qt Creator
    6. Rendering web content with QWebEngineView
    7. Using the model editor
    8. Enabling LSP on your Qt Creator
    9. Summary
  12. Section 2: Advanced Features
  13. Drawing with Qt
    1. Technical requirements
    2. Starting to draw in Qt
    3. Drawing with QPainter on QPaintDevice instances
    4. Drawing off screen
    5. Creating custom widgets
    6. Introducing the Graphics View framework
    7. Summary
  14. Doing More with Qt Quick
    1. Technical requirements
    2. Understanding the fundamental concepts of Qt Quick
    3. Using states and transitions in Qt Quick
    4. Integrating Qt Quick and C++
    5. Putting it all together – an image gallery application
    6. Introducing the new Qt Quick Controls 2
    7. Understanding the new graphical editor for SCXML
    8. Summary
  15. Implementing Multimedia with Qt Quick
    1. Technical requirements
    2. Implementing multimedia in Qt
    3. Playing audio clips and sound effects
    4. Playing video clips
    5. Accessing the camera
    6. Summary
  16. Sensors and Qt Quick
    1. Technical requirements
    2. Accessing sensors in Qt
    3. Determining device location
    4. Obtaining a device's position
    5. Placing a position marker on a Map View
    6. Accessing sensors with C++
    7. Summary
  17. Section 3: Practical Matters
  18. Localizing Your Application with Qt Linguist
    1. Technical requirements
    2. Understanding the task of localization
    3. Marking strings for localization
    4. Localizing your application with QLinguist
      1. Including localized strings in your application
    5. Localizing special parameters – currencies and dates with QLocale
    6. Summary
  19. Optimizing Performance with Qt Creator
    1. Technical requirements
    2. Introducing QML performance analysis
      1. QtSlowButton – a Qt Quick application in need of performance tuning
      2. QtLeakyButton – a Qt C++ application in need of memory help
        1. Detecting a memory leak on Linux using Valgrind
        2. Detecting a memory leak on Windows using Visual Leak Detector
    3. Introducing QML Profiler
    4. Doing more with QML Profiler
    5. Implementing test integration
      1. Creating Qt and Qt Quick tests
      2. Testing signals and slots using QSignalSpy
    6. Adding better support for test integration
      1. Creating Google tests
      2. Creating Boost tests
    7. Summary
  20. Developing Mobile Applications with Qt Creator
    1. Technical requirements
    2. Understanding mobile software development
      1. User attention is at a premium
      2. Computational resources are at a premium
      3. Network resources are at a premium
      4. Storage resources are at a premium
      5. To port or not to port?
      6. A word on testing
    3. Setting up Qt Creator for Android
      1. Downloading all the pieces
      2. Setting environment variables
      3. Finishing the Android SDK installation
      4. Configuring Qt Creator
      5. Building and running your application
    4. Deploying applications to Android devices
    5. Setting up Qt Creator for iOS
    6. Improving support for iOS and Android applications
      1. Calling Android functions from Qt
      2. Calling iOS functions from Qt
    7. Summary
  21. Embedded and IoT Development with Qt Creator
    1. Technical requirements
    2. Setting up an embedded Linux image
      1. Registering the 30-day trial Qt commercial license 
      2. Installing Qt components for device creation
      3. Writing an embedded Linux image to a storage device
    3. Building a cross-compiled Qt application
      1. Automated cross-compile using Qt Creator
      2. Manual cross-compile 
    4. Configuring Qt for an embedded project
    5. Writing your first embedded program
    6. Deploying a Qt application to an embedded system
      1. Automated deployment from Qt Creator
      2. Manual deployment using SSH
    7. Summary
  22. Qt Tips and Tricks
    1. Technical requirements
    2. Writing console applications with Qt Creator
    3. Integrating Qt Creator with version control systems
      1. Setting up your GitHub repository
      2. Setting up your GitLab repository
    4. Configuring the coding style and coding format options
    5. Applying new themes to Qt Creator
    6. Setting the Qt Quick window display options
    7. Building projects from CMake and the command line
      1. Building using qmake
      2. Building using CMake
    8. Running multiple debuggers simultaneously
    9. Learning more about Qt
    10. Summary
  23. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Application Development with Qt Creator
  • Author(s): Lee Zhi Eng, Ray Rischpater
  • Release date: January 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781789951752