'Ugly font when compiled application using Qt 6 in Linux

I compile a simple QT GUI application with Qt 5.15.2 and Qt 6.2.4 in Linux Ubuntu 20.04.4. As you see in the below figure, the font of the application compiled with Qt 6.2.4 (Right Fig) is bigger and uglier than the program compiled with Qt 5.15.2 (Left Fig). enter image description here

Point: I do not use the following code:

QApplication::setAttribute(Qt::AA_DisableHighDpiScaling);

or

QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

Point: Compile sample:

g++ -c -pipe -Wno-unused-function -O2 -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC -DAPP_TARGET


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source