Book Image

Mastering Qt 5

By : Guillaume Lazar, Robin Penea
Book Image

Mastering Qt 5

By: Guillaume Lazar, Robin Penea

Overview of this book

Qt 5.7 is an application development framework that provides a great user experience and develops full-capability applications with Qt Widgets, QML, and even Qt 3D. This book will address challenges in successfully developing cross-platform applications with the Qt framework. Cross-platform development needs a well-organized project. Using this book, you will have a better understanding of the Qt framework and the tools to resolve serious issues such as linking, debugging, and multithreading. Your journey will start with the new Qt 5 features. Then you will explore different platforms and learn to tame them. Every chapter along the way is a logical step that you must take to master Qt. The journey will end in an application that has been tested and is ready to be shipped.
Table of Contents (20 chapters)
Mastering Qt 5
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

Exploring Qt Charts


The core part is ready. It's now time to create a UI for this project, and Qt Charts can help us with this task. Qt Charts is a module that provides a set of easy-to-use chart components, such as line chart, area chart, spline chart, pie chart, and so on.

Qt Charts was previously a commercial-only Qt module. Since Qt 5.7, the module is now included in Qt on GPLv3 license for open source users. If you are stuck on Qt 5.6, you can build the module by yourself from sources. More information can be found at https://github.com/qtproject/qtcharts.

The aim now is to create two Qt widgets, CpuWidget and MemoryWidget, to display nice Qt charts of the CPU and the memory used. These two widgets will share a lot of common tasks, so we will first create an abstract class, SysInfoWidget:

Then the two actual widgets will inherit from the SysInfoWidget class and perform their specific tasks.

Create a new C++ class called SysInfoWidget with QWidget as a base class. Some enhancements must...