Search code examples
qtfelgo

The element size in the Felgo simulator is quite different from the display size on the real machine


I found that the size of the element displayed on the Felgo Live Client is very different from the size displayed on the real device, which is much larger on the Felgo Live Client.The key is that the display ratios on both sides are not the same.

Has anyone encountered this problem, thanks!

E.g.

AppButton {
    minimumWidth: 100
    minimumHeight: 100
    text:"HELLO"
}

Solution

  • Since the minimumWidth and minimumHeight are in pixels, you need to use the dp method, see https://felgo.com/doc/felgo-supporting-multiple-screens-and-screen-densities/#density-independence-support-dp-sp-pixeltoinches-tablet-orientation

    AppButton {
        minimumWidth: dp(100)
        minimumHeight: dp(100)
        text:"HELLO"
    }