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

ListView doesn't reposition some items correctly when switching orientation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.0.0, 5.4.0 Beta
    • Quick: Other
    • None

    Description

      With the code below, press the space key to change orientation. Observe the yellow square is not re-positioned correctly. This is because the delegate item has already been created internally and the item's previous y (which was defined while in the vertical orientation) is used for the new orientation.

      import QtQuick 2.0
      
      Item {
          id: root
      
          property real panelSize: 150
      
          width: 200; height: 200
      
          ListView {
              width: 200; height: 200
      
              model: VisualItemModel {
                  Rectangle { width: root.panelSize; height: root.panelSize; color: "red" }
                  Rectangle { width: root.panelSize; height: root.panelSize; color: "yellow" }
                  Rectangle { width: root.panelSize; height: root.panelSize; color: "green" }
              }
      
              focus: true
      
              Keys.onSpacePressed: {
                  orientation = Qt.Horizontal
              }
          }
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes