Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112691

StackLayout Visible Item Does Not Update During Inserts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.4.1
    • Quick: Layouts
    • None
    • Windows

    Description

      I have been using a ListView paired with a StackLayout to implement tabs in QML. The StackLayout uses a repeater, driven by the same model as a ListView, to create the pages. I've discovered that when an item is inserted into the model at the currentIndex, the StackLayout does not change its visible item. This can be demonstrated in the attached example.

      In the example, there is a ListModel with 3 items. When the application is started, the 3 items are visible in the ListView and in the StackLayout. Clicking on an item in the ListView changes the visible page in the StackLayout. An Insert button is overlaid on to the Window. When Insert is pressed, a new item is inserted in to the ListModel at the currentIndex. The expected behavior would be that the ListView and StackLayout add a new delegate and display it. The ListView should highlight the new item and the StackLayout should make it visible. The ListView does meet this expectation, but the StackLayout continues to display the previously selected item. Selecting a different item in the ListView and then changing back to the original index does resolve the issue.

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tvoils Thomas Voils
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: