Reader small image

You're reading from  Qt 6 C++ GUI Programming Cookbook - Third Edition

Product typeBook
Published inApr 2024
PublisherPackt
ISBN-139781805122630
Edition3rd Edition
Right arrow
Author (1)
Lee Zhi Eng
Lee Zhi Eng
author image
Lee Zhi Eng

Lee Zhi Eng is a self-taught programmer who worked as an artist and programmer at several game studios before becoming a part-time lecturer for 2 years at a university, teaching game development subjects related to Unity and Unreal Engine. He has not only taken part in various projects related to games, interactive apps, and virtual reality but has also participated in multiple projects that are more oriented toward software and system development. When he is not writing code, he enjoys traveling, photography, and exploring new technologies.
Read more about Lee Zhi Eng

Right arrow

Preface

With the growing need to develop GUIs for multiple targets and 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.

Qt 6 C++ GUI Programming Cookbook, Third Edition, teaches you how to develop functional and appealing user interfaces using the latest version of QT6 and C++. This book will help you learn a variety of topics such as GUI customization and animation, graphics rendering, and implementing Google Maps. You will also explore advanced concepts such as asynchronous programming, event handling using signals and slots, network programming, and 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 client’s expectations and understand the best practice solutions for common problems.

Who this book is for

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

What this book covers

Chapter 1, Look-and-Feel Customization with Qt Designer, shows you how to design your program’s user interface using both Qt Creator and Qt Design Studio.

Chapter 2, Event Handling – Signals and Slots, covers topics related to the signals and slots mechanism provided by Qt 6, which allows you to handle your program’s event callbacks with ease.

Chapter 3, States and Animations with Qt and QML, explains how to animate your user interface widgets by empowering the state machine framework and the animation framework.

Chapter 4, QPainter and 2D Graphics, covers how to draw vector shapes and bitmap images on screen using Qt’s built-in classes.

Chapter 5, OpenGL Implementation, demonstrates how to render 3D graphics in your program by integrating OpenGL into your Qt project.

Chapter 6, Transitioning from Qt5 to Qt6, covers how you can transition your Qt 5 project to Qt 6 and discusses the differences between the two versions.

Chapter 7, Using Network and Managing Large Documents, shows you how to set up an FTP file server and then create a program that helps you to transfer files to and from it.

Chapter 8, Threading Basics – Asynchronous Programming, covers how to create multithreading processes in your Qt 6 application and run them simultaneously to process heavy calculations.

Chapter 9, Building a Touchscreen Application with Qt 6, explains how to create a program that works on a touchscreen device.

Chapter 10, JSON Parsing Made Easy, shows how to process data in the JSON format and use it together with the Google Geocoding API to create a simple address finder.

Chapter 11, Conversion Library, covers how to convert between different variable types, image formats, and video formats using Qt’s built-in classes as well as third-party programs.

Chapter 12, Accessing Databases with SQL Driver and Qt, explains how to connect your program to a SQL database using Qt.

Chapter 13, Develop Web Applications Using Qt WebEngine, covers how to use the web rendering engine provided by Qt and develop programs that empower web technology.

Chapter 14, Performance Optimization, shows you how to optimize your Qt 6 application and speed up its processing.

To get the most out of this book

You will need the following software/hardware to try the learnings from this book:

Software/hardware covered in the book

Operating system requirements

Qt Creator 12.0.2

Windows, macOS, or Linux

Qt Design Studio

Windows, macOS, or Linux

SQLiteStudio

Windows, macOS, or Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/QT6-C-GUI-Programming-Cookbook---Third-Edition-/tree/main. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “A slot function called on_pushButton_clicked() will now appear in both mainwindow.h and mainwindow.cpp.”

A block of code is set as follows:

import QtQuick
import QtQuick.Window
Window {
   visible: true
   width: 640
   title: qsTr("Hello World")
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

width: 128;
 	height: 128;
 	x: -128;
 	y: parent.height / 2;

Any command-line input or output is written as follows:

find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Select Application (Qt) under the Projects window, and then select Qt Widgets Application.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Qt 6 C++ GUI Programming Cookbook, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/978-1-80512-263-0

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Qt 6 C++ GUI Programming Cookbook - Third Edition
Published in: Apr 2024Publisher: PacktISBN-13: 9781805122630
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Lee Zhi Eng

Lee Zhi Eng is a self-taught programmer who worked as an artist and programmer at several game studios before becoming a part-time lecturer for 2 years at a university, teaching game development subjects related to Unity and Unreal Engine. He has not only taken part in various projects related to games, interactive apps, and virtual reality but has also participated in multiple projects that are more oriented toward software and system development. When he is not writing code, he enjoys traveling, photography, and exploring new technologies.
Read more about Lee Zhi Eng