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

anchors.verticalCenter miscalculated with real height & y

XMLWordPrintable

    • fd23a222e (dev)

      Anchoring a rectangle to the verticalCenter of parent rectangle when both use real values for height / y seems to result in a miscalculation in the position.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              id:rect2
              width: 100
              height : 41.2
              color: "light blue"
      
              Rectangle {
                  id:line2
                  anchors.verticalCenter: parent.verticalCenter
                  anchors.alignWhenCentered: false
                  width: 100
                  height: 0.9
                  color: "black"
                  onYChanged: console.log("Y, HEIGHT:", y, height)
              }
          }
      }
      

      The output would be: qml: Y, HEIGHT: 20.650000000000002 0.9.

      Steps to reproduce the problem:

      • Run the attached project

        1. qtbug95224.zip
          2 kB
        2. tweakable.qml
          2 kB
        3. listview-torture.qml
          2 kB
        For Gerrit Dashboard: QTBUG-95224
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            miikapernu Miika Pernu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes