Qt World Summit: Submit your Presentation

Relative pixel size and component visualization different depending on OS or HW

  • I'm trying to develop a Qml application for an embedded system in Qt Creator. Since the screen size of the target system is always the same (Full HD), I decided to go for a fixed size application. To avoid any problems, I would really like to "define each physical pixel". I would also expect that the proportions stay the same since I have a Full HD screen. The application is defined accordingly with 1920x1080px and all the elements defined in pixel.

    However, first problem, a font with size 20px does not look the same on an Intel NUC and my custom hardware (they differ in the Linux Kernel). They don't use the same hardware, but both of them have a Full HD screen. So how can font size 20px be different on one system than on the other, if both live in a world of 1920x1080px in total? If pixel sizes are really different, then the window would also not fit the screen. And furthermore, if there is some scaling, this would be equally applied to any pixel, I assume.

    The same applies for the size and position of Qml components. They overlap each other on one system, while they're fine on the other system.

    I'm using a Material style, but even removing it does not solve this issue.

    Also, the positions in QtCreator do not correspond to either one of the realities. The .ui.qml is completely off, while the .qml is more or less accurate in positions except from not showing any Material style of the elements.

    This starts to get really annoying. I'm doing trial & error with blindly moving the elements millimeters, building for my embedded system (which takes quite a lot of time) and repeating this process for hours.

  • I checked out the ratio of the main frame on the embedded system, which is the same as on my desktop. The fixed pixel width and height of the main window are exactly the same.

    The high dpi scaling attribute has no influence. Also switching from font.pixelSize to font.pointSize has the same unwanted effect.

    How can the font proportions turn out different? If the main windows height is defined as 1080px, a font size of 20px must be clearly defined relative to it (1/54 of the main window height). But why does it take, let's say, 24px on my embedded system (which is 1/45)?

    I can find many posts about scaling, but what I want is no automatic, random scaling at all.