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

SplitView: Fractional widths cause paint artifacts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.0
    • Quick: Controls 2
    • macOS, metal/opengl
    • macOS

    Description

      The SplitView's width distribution does not round the item's calculated widths to integers.

      As usual when using fractional coordinates for positioning items this can cause all kinds of painting artefacts due to rounding errors (jagged lines, jittering text positioning etc.) that do not occur when using integer coordinates.

      "jitter" demonstration: Please watch the "A" in the white rectangle when resizing.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
      
        SplitView {
          anchors.fill: parent
      
          Rectangle {
            SplitView.preferredWidth: 200
            color: "yellow"
      
            Text {
              anchors.centerIn: parent
              text: parent.x
            }
          }
      
          Rectangle {
            SplitView.preferredWidth: 200
            SplitView.fillWidth: true
            color: "lightsteelblue"
      
            // example for "text jitter"
            Rectangle {
              width: t.width
              height: 100
              Text {
                id: t
                text: "A"
                anchors.centerIn: parent
              }
            }
      
            Text {
              anchors.centerIn: parent
              text: parent.x
            }
          }
        }
      }
      

      Either rounding the widths by default or adding a rounding property to SplitView would be splendid.

      Attachments

        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
            njeisecke Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes