Adding the Linux implementation

Let's make the Linux implementation of our ch02-sysinfo project. If you have already done the Windows implementation, it will be a piece of cake! If you have not, you should take a look at it. Some information and tips will not be repeated in this part, such as how to create a SysInfo implementation class, keyboard shortcuts, and details about the SysInfo interface.

Create a new C++ class called SysInfoLinuxImpl that inherits from the SysInfo class, and insert virtual functions from the base class:

#include "SysInfo.h" 
 
class SysInfoLinuxImpl : public SysInfo 
{ 
public: 
    SysInfoLinuxImpl(); 
 
    void init() override; 
    double cpuLoadAverage() override; 
    double memoryUsed() override; 
}; 

We will start by implementing the ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.