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...