Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

How to ignore the system's DPI setting?

$
0
0
I had a puzzling effect in a GraphicsScene, where I use QGraphicsTextItem. There are two items which show the same data. One of them shows a bigger font that the other. (The plain texts are different in the screenshot to make the items more easily distinguishable, but the effect occurs even if the text is identical) The solution lies in the system’s DPI setting. When creating the QFont for a newly inserted item, Qt seems to recognize the system’s DPI setting (“large fonts”) and creates a font that looks slightly bigger. The second item is instead created from data read from an XML stream. The data itself is identical, but the QFont seems to be created in a context where the system’s DPI setting cannot be recognized. Hence it’s displayed smaller. The problem is that for this graphical representation, I absolutely cannot have the system’s DPI setting fool around with my object sizes. They must look the same in relation to each other (e.g. a text in relation to a nearby graphic), regardless of the local system settings. How do I tell Qt to ignore the system’s DPI setting?

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>