Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 6.10.3 Android: layout changes defeat drags, text input
Qt 6.11 is out! See what's new in the release blog

Qt 6.10.3 Android: layout changes defeat drags, text input

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt quickandroidlayoutdrag
7 Posts 3 Posters 239 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    barbicels
    wrote last edited by barbicels
    #1

    Many Android developers have reported that changing the state of Qt Quick controls can cause the Android OS to "rebuild" the corresponding views in its layout. That seems to be causing multiple problems in my code with GUI actions like drags and continuous typing that result in automatic changes to other Qt Quick controls.

    For example:

    • An instant search based on what has been typed in a TextField (without waiting to press Enter) causes the text field to lose focus and the soft keyboard to close, because the change in the geometry of controls showing search results causes a layout rebuild; it is as if the underlying text view has been deleted and recreated.
    • A ToolTip that is programmed to appear when tapping and holding a button closes immediately or does not appear at all, as the layout rebuild appears to "untap" the button.
    • A RangeSlider whose properties are bound by a numeric readout Label at each end can only be dragged one step at a time, because changing a label's text causes a layout rebuild and kills the drag.

    Our code is too complex to share here, but I'll point out that all of this code works perfectly on iOS, where the association between a Qt Quick control and the OS's underlying view is permanent across layout actions.

    Has anyone faced this problem, and managed to overcome it? The last thing I want is to have to throw in a time delay so that the GUI action can be continuous.

    Environment: Android 16, Qt 6.10.3

    ekkescornerE 1 Reply Last reply
    0
    • M Offline
      M Offline
      mskyyyf wiieyy
      wrote last edited by
      #2

      Ugh, I’ve fought this exact same issue on Android Qt! The view rebuilds are brutal, especially with anything interactive like sliders or live search.
      A trick that helped me: wrap the dynamic parts of your UI in a MouseArea and use QtQuick.Controls.Overlay for elements that don’t need to affect the layout directly. It prevents the geometry changes from triggering full layout passes mid-interaction.
      Also, double-check that you’re not binding properties that trigger implicitWidth/implicitHeight updates unnecessarily — those are usually the culprits.

      B 2 Replies Last reply
      0
      • B barbicels

        Many Android developers have reported that changing the state of Qt Quick controls can cause the Android OS to "rebuild" the corresponding views in its layout. That seems to be causing multiple problems in my code with GUI actions like drags and continuous typing that result in automatic changes to other Qt Quick controls.

        For example:

        • An instant search based on what has been typed in a TextField (without waiting to press Enter) causes the text field to lose focus and the soft keyboard to close, because the change in the geometry of controls showing search results causes a layout rebuild; it is as if the underlying text view has been deleted and recreated.
        • A ToolTip that is programmed to appear when tapping and holding a button closes immediately or does not appear at all, as the layout rebuild appears to "untap" the button.
        • A RangeSlider whose properties are bound by a numeric readout Label at each end can only be dragged one step at a time, because changing a label's text causes a layout rebuild and kills the drag.

        Our code is too complex to share here, but I'll point out that all of this code works perfectly on iOS, where the association between a Qt Quick control and the OS's underlying view is permanent across layout actions.

        Has anyone faced this problem, and managed to overcome it? The last thing I want is to have to throw in a time delay so that the GUI action can be continuous.

        Environment: Android 16, Qt 6.10.3

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote last edited by ekkescorner
        #3

        @barbicels what's your JDK and NDK and have you tried 6.11.1 ?

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps

        B 1 Reply Last reply
        0
        • ekkescornerE ekkescorner

          @barbicels what's your JDK and NDK and have you tried 6.11.1 ?

          B Offline
          B Offline
          barbicels
          wrote last edited by
          #4

          @ekkescorner NDK is 27.2.12479018 and JDK is 17.0.2, acceptable according to Qt Creator.

          ekkescornerE 1 Reply Last reply
          0
          • M mskyyyf wiieyy

            Ugh, I’ve fought this exact same issue on Android Qt! The view rebuilds are brutal, especially with anything interactive like sliders or live search.
            A trick that helped me: wrap the dynamic parts of your UI in a MouseArea and use QtQuick.Controls.Overlay for elements that don’t need to affect the layout directly. It prevents the geometry changes from triggering full layout passes mid-interaction.
            Also, double-check that you’re not binding properties that trigger implicitWidth/implicitHeight updates unnecessarily — those are usually the culprits.

            B Offline
            B Offline
            barbicels
            wrote last edited by
            #5

            @mskyyyf-wiieyy

            I'm familiar with the practice of using the Overlay.overlay attached property to parent an item that floats above the window (with geometry in global coordinates). In our case, the stuff that needs re-layout is part of the same scrollable Qt layout as the controls whose changes cause that to happen — all pretty normal mobile-app behavior — so I don't know how I would make that work.

            Can you point me to a minimal working example of this? That would be fantastic.

            1 Reply Last reply
            0
            • B barbicels

              @ekkescorner NDK is 27.2.12479018 and JDK is 17.0.2, acceptable according to Qt Creator.

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote last edited by
              #6

              @barbicels yep, that's ok. 6.11 needs JDK 21

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps

              1 Reply Last reply
              0
              • M mskyyyf wiieyy

                Ugh, I’ve fought this exact same issue on Android Qt! The view rebuilds are brutal, especially with anything interactive like sliders or live search.
                A trick that helped me: wrap the dynamic parts of your UI in a MouseArea and use QtQuick.Controls.Overlay for elements that don’t need to affect the layout directly. It prevents the geometry changes from triggering full layout passes mid-interaction.
                Also, double-check that you’re not binding properties that trigger implicitWidth/implicitHeight updates unnecessarily — those are usually the culprits.

                B Offline
                B Offline
                barbicels
                wrote last edited by
                #7

                @mskyyyf-wiieyy
                I'm not clear on what the MouseArea accomplishes in that solution, but I think you're telling me that any interactive control like a slider or a live-search text field should be parented to Overlay.overlay and thus be immune to all the effects of the layout passes that result from those interactions. Correct?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved