QML incorrect positioning elements in very simple code (with video)



  • I made the following minimal code example:

    import QtQuick 2.6
    import QtQuick.Window 2.2
    
    Window {
        visible: true
        width: 500
        height: 500
    
        Rectangle
        {
            anchors.fill: parent
            color: "blue"
        }
    
        Rectangle
        {
            x: 0
            y: 0
            width: 100
            height: 100
            color: "red"
        }
    }
    

    This is just a window with a blue background and a red rectangle in the upper left corner.

    It would seem that there may be a bug? The bug start when the window size changes. I cannot take screenshots, because at the time of the screenshot, the windows seem to be redrawn, and the screenshot is obtained with the “correct” content.

    Therefore, I post the video: https://youtu.be/0ewK6jrqWms

    It can be seen that if you double-click "Expand", then the contents of the window becomes incorrect: the blue fill does not begin at the top of the window, but with some kind of vertical indent. The red square is also shifted down to the same indent.

    If you move the window, the contents of the window remains wrong, but at some point it suddenly redraws, and again becomes correct.

    Question: what is the problem, and how to make sure that the window is always drawn correctly? This is a glitch on such a simple example, but imagine what happens in a real project with a bunch of elements with calculated sizes and scaling.

    This bug is present in Qt 5.9.2 and Qt 5.11.2 (installation from qt.io site) in Debian Linux 9 Stable (LXDE).


  • Qt Champions 2017

    This could issue very specific to Debian box. Did not see the similar issue in Windows or Mac. You file bug as well.



  • @dheerendra

    We see this bug in next configurations:

    • Qt 5.9.2 and Qt 5.11.2 (install from qt.io site) in Debian Linux 9 Stable, Openbox+LXDE, Intel i915.
    • KWin/KDE, Qt 5.11.1, Intel i915 GPU

    We NOT see this bug:

    • Plasma and KWin 5.14.4, Qt 5.11.2, nvidia-driver 415.18
    • Ubuntu 18.04, Qt 5.9.5
    • Windows 10, Qt5.11.2
    • Windows, Qt 5.12

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.