@bbiw I would advise against doing any manual computation for the scaling. If you want to use the native toolkit, use grid unit and the toolkit's components so scaling would works automatically. If not, you could explore using QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
In any case, scaling can still be buggy in UT so you might also be hitting one. For example, there are apps where some elements have bad scaling once you connect to an external display while the app is already open, however the scaling is fixed if you open the app after the external display is already connected.