Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › AppMap broken on Android: Scaling does not work, fonts are not readable

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #22897

    Micu

    Hi FELGO folks,

    Unfortunately, the AppMap is still basically broken on Android (look here for our previous report). Just try out your own Maps Demo or even just look at your own screenshots for it: The scaling is broken, the fonts are not readable.

    With FELGO’s own scaling system in place, your advice is not to use

    <meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>

    — and if one does anyway, the navigation bar has a twice its height on many Android devices. The solution to use manual scaling as suggested here does not work (see link).

    With FELGO apparently wanting to become the goto Qt for mobile solution, and maps being a pivotal feature for mobile applications, I am a bit perplexed that this issue does not take a higher priority?

    Do you have any suggestions?

    Best,

    micu

    #22913

    Alex
    Felgo Team

    Hi Micu,

    what map provider are you using? Here is a potential fix that you can try:

    main.cpp

    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // Add this as first line of the main function

    Main.qml

    import Felgo 3.0
    import QtQuick.Window 2.12
    
    App {
      onInitTheme: {
        // this hotfixes a faulty status bar height size after enabling the default Qt high dpi support in main.cpp
        Theme.statusBarHeight = Theme.statusBarHeight/Screen.devicePixelRatio
      }
    
      // ...
    
    }

    Let me know if this fixes the map scaling, and if your remaining app UI works as expected. We could then go ahead and try to apply a similar solution within the engine itself.

    Cheers,
    Alex

    #22964

    Micu

    Hi Alex,

    thanks a lot for your answer! <3

    Unfortunately, this workaround doesn’t work šŸ™

    TypeError: Cannot assign to read-only property "statusBarHeight"

    (Now I actually remember I have tried this already myself).

     

     

     

     

    BTW: What is the difference between

    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // Add this as first line of the main function

    and

    <meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>

    on Android?

     

    what map provider are you using?

    MapBox…. but as Julian wrote in hisĀ  previous post, this issue is independent of the map provider.

     

    Best,

    micu

     

    #22965

    Micu

    Addendum: I tried sth. else

    Theme.navigationBar.height = Theme.navigationBar.height/Screen.devicePixelRatio
    

    This does not lead to a syntax error, it also makes the bar have the right height. BUT: The icons left and right of the navigation bar (back button e.g.) are shifted half of the bar height down now šŸ™

     

    #23031

    Julian

    Honestly, this is getting really frustrating. And kind of a deal-breaker. In the picture below you can see on the left how it looks like without autoscaling and on the right with the following patch:

    navigationBar.anchors.topMargin: -navigationBar.height / 2.5;

    https://www.dropbox.com/s/ni54xfy2enetfxh/Screenshot%202020-03-13%20at%2011.51.42.png?dl=0

    The factor is obviously hard-coded, so I doubt this will work across different devices. I haven’t found out which variable is set incorrectly in Felgo, so I cannot workaround it.

    Cheers,

    Julian

    #23033

    Julian

    @alex here is the workaround we came up with incl. some values for navigationBar.height and Theme.statusBarHeight:

    NavigationStack {
    
    ...
    
        Component.onCompleted: {
            // This hotfixes a faulty navigation bar height on Android after enabling the default Qt high dpi support in main.cpp:
            if (!BVApp.Platform.isAndroid) {
                return
            }
            // Before the next line "navigationBar.height = 139.97597452201887" on my test device.
            anchors.topMargin = 1
            // The line above triggers something so that the "navigationBar.height = 55.97597452201887", but now it is partly hidden
            // by the status bar on Android, so we add "Theme.statusBarHeight" but taking the high dpi scaling factor into account.
            navigationBar.height += Theme.statusBarHeight / Screen.devicePixelRatio
            // Afterwards the "navigationBar.height = 79.96567788859839". Next we reset the anchor again to its default value.
            anchors.topMargin = 0
            // As comparison: without high dpi "navigationBar.height = 56" and "Theme.statusBarHeight = 24" on my test device.
        }
    }

    For me the weirdest part is that changing topMargin changes theĀ navigationBar.height.

    Best regards,

    Julian

    #23811

    Micu
    #23828

    Alex
    Felgo Team

    Hi,

    Thanks for sharing your input on this one! We already created a ticket in our tracker so that we can provide a fix without any required hacks in the future (including the check for the topMargin, as reported by Julian).

    Best,

    Alex from Felgo

    PS: Congratulations to the new release, will check it out!

Viewing 8 posts - 1 through 8 (of 8 total)

RSS feed for this thread

You must be logged in to reply to this topic.