Mastering Qt 5

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

An In-depth guide updated with the latest version of Qt 5.11 including new features such as Quick Controls and Qt Gamepad

Key Features

  • Unleash the power of Qt 5.11 with C++
  • Build applications using Qt Widgets (C++) or Qt Quick (QML)
  • Create cross-platform applications for mobile and desktop platforms with Qt 5

Book Description

Qt 5.11 is an app development framework that provides a great user experience and develops full capability applications with Qt Widgets, QML, and even Qt 3D. Whether you're building GUI prototypes or fully-fledged cross-platform GUI applications with a native look and feel, Mastering Qt 5 is your fastest, easiest, and most powerful solution. This book addresses various challenges and teaches you to successfully develop cross-platform applications using the Qt framework, with the help of well-organized projects.

Working through this book, you will gain a better understanding of the Qt framework, as well as the tools required to resolve serious issues, such as linking, debugging, and multithreading. You'll start off your journey by discovering the new Qt 5.11 features, soon followed by exploring different platforms and learning to tame them. In addition to this, you'll interact with a gamepad using Qt Gamepad. Each chapter is a logical step for you to complete in order to master Qt.

By the end of this book, you'll have created an application that has been tested and is ready to be shipped.

What you will learn

  • Create stunning UIs with Qt Widgets and Qt Quick 2
  • Develop powerful, cross-platform applications with the Qt framework
  • Design GUIs with the Qt Designer and build a library in it for UI previews
  • Handle user interaction with the Qt signal or slot mechanism in C++
  • Prepare a cross-platform project to host a third-party library
  • Use the Qt Animation framework to display stunning effects
  • Deploy mobile apps with Qt and embedded platforms
  • Interact with a gamepad using Qt Gamepad

Who this book is for

Mastering Qt 5 is for developers and programmers who want to build GUI-based applications. C++ knowledge is necessary, and knowing QT basics will help you get the most out of this book.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Author(s): Guillaume Lazar, Robin Penea
Edition: 2
Publisher: Packt Publishing
Year: 2018

Language: English
Commentary: Converted
Pages: 534
City: Birmingham
Tags: Programming;Qt5;C++;CPP;GUI;User Interface

1: Get Your Qt Feet Wet
Qt project basic structure
MainWindow structure
Qt Designer interface
Signals and slots
Custom QWidget
Adding a task
Using a QDialog
Distributing code responsibility
Emitting a custom signal using lambdas
Simplifying with the auto type and a range-based for loop
Summary

2: Discovering qmake Secrets
Designing a cross-platform project
Transforming SysInfo into a singleton
Exploring Qt Charts
CpuWidget using QCharts
Memory using Qcharts
The .pro file in depth
Under the hood of qmake
Beneath Q_OBJECT and signals/slots
Summary

3: Dividing Your Project and Ruling Your Code
Designing a maintainable project
Defining data classes
Storing your data in a database
Protecting your code with a smart pointer
Implementing the model
Summary

4: Conquering the Desktop UI
Creating a GUI linked to a core shared library
Listing your albums with AlbumListWidget
Creating ThumbnailProxyModel
Displaying the selected album with AlbumWidget
Enhancing thumbnails with PictureDelegate
Displaying a picture with PictureWidget
Composing your Gallery app
Summary

5: Dominating the Mobile UI
Starting with Qt Quick and QML
Checking your development environment
Creating a Qt Quick project
Preparing your Qt Quick gallery entry point
Displaying albums with ListView
Theming the application with a QML singleton
Loading a database on mobile devices
Creating a new album from a custom InputDialog
Loading images with an ImageProvider
Displaying thumbnails in GridView
Swiping through full resolution images
Summary

6: Even Qt Deserves a Slice of Raspberry Pi
Discovering Qt3D
Configuring Qt for your Raspberry Pi
Creating an entry point for your Qt3D code
Setting up the scene
Assembling your Qt3D entities
Preparing the board game
Crafting entities from the factory
Building a snake engine in JavaScript
Varying the HUD with QML states
Profiling your QML application
Summary

7: Third-Party Libraries without a Headache
Creating your Qt Designer plugin
Configuring the project for Windows
Configuring the project for Linux
Configuring the project for Mac
Implementing your OpenCV filters
Designing the UI with FilterWidget
Exposing your plugin to Qt Designer
Using your Qt Designer plugin
Building the image-filter application
Summary

8: Animations - Its Alive, Alive!
Creating an SDK using the Qt Plugin system
Creating your plugins
Loading your plugins dynamically
Using the plugins inside the application
Discovering the Animation Framework
Making your thumbnails jump
Fading in the picture
Flashing the thumbnail in a sequence
Summary

9: Keeping Your Sanity with Multithreading
Discovering QThread
Flying over Qt multithreading technologies
Architecting the Mandelbrot project
Defining a Job class with QRunnable
Using QThreadPool in MandelbrotCalculator
Displaying the fractal with MandelbrotWidget
Summary

10: Need IPC? Get Your Minions to Work
Inter-process communication techniques
Architecturing an IPC project
Laying down the foundations with an SDK
Working with QDataStream and QTcpSocket
Interacting with sockets in the worker
Interacting with sockets from the application
Building your own QTcpServer
Summary

11: Having Fun with Multimedia and Serialization
Architecting the drum machine project
Creating a drum track
Making your objects serializable with QVariant
Serializing objects in JSON format
Serializing objects in XML format
Serializing objects in binary format
Playing low-latency sounds with QSoundEffect
Triggering a QButton with your keyboard
Bringing PlaybackWorker to life
Accepting mouse drag-and-drop events
Summary

12: You Shall (Not) Pass with QTest
Discovering Qt Test
Executing your tests
Writing factorized tests with datasets
Benchmarking your code
Testing your GUI
Spying on your application with QSignalSpy
Summary

13: All Packed and Ready to Deploy
Packaging your application
Packaging for Windows
Packaging for Linux with a distribution package
Packaging for Linux with AppImage
Packaging for OS X
Packaging for Android
Packaging for iOS
Summary

14: Qt Hat Tips and Tricks
Managing your workspace with sessions
Searching with the Locator
Increasing the compilation speed
Examining memory with Qt Creator
Generating random numbers
Silencing unused variable warnings
Logging custom objects to QDebug
Improving log messages
Saving your logs to a file
Generating a command-line interface
Sending and receiving HTTP data
Playing with Qt Gamepad
Styling QML with Qt Quick Controls 2
Summary