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

Multiple Positioner.isLastItem == true properties in one positioner

    XMLWordPrintable

Details

    • 3d5ffa7102e3373942a6b889386bc77a9c957be0

    Description

      I think it would be easier to explain on the example:

      import QtQuick 2.0
      
      Rectangle {
          width: 100
          height: 400
          color: "#808080"
      
          Column {
              anchors.fill: parent
              Rectangle {
                  width: 100; height: 100
                  color: Positioner.isFirstItem ? "red" : (Positioner.isLastItem ? "blue" : "green")
                  border.width: 1
                  border.color: "black"
              }
              Rectangle {
                  width: 100; height: 100
                  color: Positioner.isFirstItem ? "red" : (Positioner.isLastItem ? "blue" : "green")
                  border.width: 1
                  border.color: "black"
              }
              Rectangle {
                  width: 100; height: 100
                  color: Positioner.isFirstItem ? "red" : (Positioner.isLastItem ? "blue" : "green")
                  border.width: 1
                  border.color: "black"
              }
              Rectangle {
                  width: 100; height: 100
                  color: Positioner.isFirstItem ? "red" : (Positioner.isLastItem ? "blue" : "green")
                  border.width: 1
                  border.color: "black"
      
                  visible: !mouseArea.pressed
              }
          }
      
          MouseArea {
              id: mouseArea
              anchors.fill: parent
          }
      }
      

      This code works simply: we have a column of 4 rectangles. The color of rectangle depends on its position in the column - the blue one is the last one. On press we hide the last item, so there is the new last item (the third one from top) and it correctly becomes blue. When we release the button, then the fourth item is shown again and it is correctly blue, but the third item, which is not last anymore remains blue as it's Positioner.isLastItem reamins true. So there are 2 items which are last at the same time - which is obviously not correct.

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            faldżip Filip Piechocki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes