Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

it seams that since Qt5.7, QML repaint incorrectly on switching between maximum and normalsize window



  • as title, it seems that since Qt5.7, QML repaint incorrectly on changing to maximum window. I reproduced it with Qt 5.7.1, 5.8.0, 5.9.2, Qt 5.6 and 5.5 don't have this issue.

    Anybody has idea about this?

    how to reproduce:

    1. load qml file with qmlscene provided by Qt5.9.2, the screenshot as follows,
      load qml
    2. change to maximum, you'll find the window doesn't paint correctly.
      change to maximum size
    3. then, change back to normal size, the window still paints incorrectly.
      change back to normal size
    4. if you switch view(the second rectangle on the left in my app, from yellow to green), the window redraw correctly again
      switch view in maximum window
    5. after step 3, if you change the window size by dragging edge of window, the window will also repaint correctly:
      0_1511602231295_change_size_by_draging_edge_in_incorrect_normal_size.png

    my qml file as follows,

    import QtQuick 2.0
    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.4
    import QtQuick.Layouts 1.0
    
    ApplicationWindow {
        id: window
        visible: true
        width: 640
        height: 480
    
        Item {
            id: mainFrame
            anchors.fill: parent
    
            property var viewTab: viewTab
            property var leftSideBar: leftSideBar
            property var contentArea: contentArea
            property var rigthSideBar: rigthSideBar
    
            Column {
                id: viewTab
                width: 40
                clip: false
                visible: true
                anchors.left: parent.left
                anchors.leftMargin: 0
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 0
                anchors.top: parent.top
                anchors.topMargin: 0
    
                Repeater {
                    model: leftSideBarView.count
                    anchors.horizontalCenter: parent.horizontalCenter
                    Rectangle {
                        width: 32
                        height: 32
                        border.width: 1
                        anchors.horizontalCenter: parent.horizontalCenter
                        Text {
                            anchors.centerIn: parent
                            //text: view.getTab(index).title
                        }
                        MouseArea {
                            anchors.fill: parent
                            cursorShape: Qt.PointingHandCursor
                            onClicked: leftSideBarView.currentIndex = index
                        }
                    }
                }
            }
    
            Item {
                id: leftSideBar
                anchors.left: viewTab.right
                anchors.leftMargin: 0
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                width: 100
    
                RowLayout {
                    spacing: 0
                    anchors.fill: parent
    
                    // StackLayout {
                    TabView {
                        id: leftSideBarView
                        Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                        Layout.fillWidth: true
                        Layout.fillHeight: true
    
                        currentIndex: 0
    
                        Tab {
                            id: homeTab
                            Rectangle {
                                anchors.fill: parent
                                color: "yellow"
                            }
                        }
                        Tab {
                            id: discoverTab
                            Rectangle {
                                anchors.fill: parent
                                color: "green"
                            }
                        }
                        Tab {
                            id: activityTab
                            Rectangle {
                                anchors.fill: parent
                                color: "gray"
                            }
                        }
    
                        style: TabViewStyle {
                            tab: null
                            frame: Rectangle {
                                color: "green"
                            }
                        }
    
                    }
    
                    Flickable {
                        id: flickableLeft
                        boundsBehavior: Flickable.DragOverBounds
                        flickableDirection: Flickable.HorizontalFlick
                        Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
                        Layout.fillHeight: true
                        Layout.maximumWidth: 4
                        Layout.minimumWidth: 4
                        Layout.preferredWidth: 4
                    }
                }
            }
    
            Rectangle {
                id: contentArea
                color: "#b31515"
                anchors.left: leftSideBar.right
                anchors.right: rigthSideBar.left
                anchors.top: parent.top
                anchors.bottom: parent.bottom
            }
    
            Rectangle {
                id: rigthSideBar
                anchors.right: parent.right
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                width: 100
    
                RowLayout {
                    spacing: 0
                    anchors.fill: parent
                    Flickable {
                        id: flickableRight
                        boundsBehavior: Flickable.DragOverBounds
                        flickableDirection: Flickable.HorizontalFlick
                        Layout.maximumWidth: 4
                        Layout.minimumWidth: 4
                        Layout.preferredWidth: 4
                        Layout.fillHeight: true
                        Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                    }
    
                    Rectangle {
                        id: rigthSideBarContainer
                        Layout.fillWidth: true
                        Layout.fillHeight: true
                        color: "blue"
                    }
                }
            }
        }
    }
    


  • @astreye Hi. I can reproduce the behavior. Boiled it down to this:

    import QtQuick 2.7
    import QtQuick.Controls 2.2
    
    ApplicationWindow {
        id: window
        visible: true
        width: 640
        height: 480
    
        Rectangle {
            id: leftSideBar
            color: "purple"
            anchors.leftMargin: 0
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            width: 100
        }
    
        Rectangle {
            color: "orange"
            anchors.left: leftSideBar.right
            anchors.right: rigthSideBar.left
            anchors.top: parent.top
            anchors.bottom: parent.bottom
        }
    
        Rectangle {
            id: rigthSideBar
            color: "pink"
            anchors.right: parent.right
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            width: 100
        }
    
    }
    

Log in to reply