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

Broken QQuickItem position with big numbers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.3, 5.12.3
    • None
    • Linux/X11

    Description

      When an item is translated by a high offset its position is not updated correctly,

      The following snippet reproduce the problem:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")    
          
          property real offset: 775999618    
          
          Item {
              id: item        
              x: -offset
              width: parent.width
              height: parent.height        
              Rectangle {
                  width: 100
                  height: 100
                  color: "red"
                  x: offset
              }
          }    
          
          MouseArea {
              anchors.fill: parent
              drag.target: item
          }
      }
      

      The expected behavior isĀ  a smooth dragging of the item (and it's red child rectangle). What happen is that along the X-Axis the inner item is moved with some kind of step. Maybe this could be caused by some kind of error accumulated in the internals of QQuickItem private classes when working with doubles (or maybe a rounding somewhere).

      Obviously dragging the item on the Y-Axis doesn't cause any problem because the offset on that axis is 0.

      Another thing to note is that the offset is inside the range of int32_t, In other words is not so big and it should not be truncated given that all QtQuick stuff work with qreal (floats).

      Attachments

        1. bug.tar.gz
          2 kB
        2. main.qml
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            cuke Filippo Cucchetto
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes