Simple question about performance troubles



  • I have trouble with this simple application. It will respond very slowly (processor usage is over 90%) if I have background picture or just pure Rectangle (id: background in example bellow) before button, if I comment this background rectangle, application would react quickly, but if I add "enable.layers: true" to root item, slow response would be come back .
    Where is the problem?
    I would like to have background picture and fast response on clicking.
    I am running this example on Raspberry Pi 3.

    
    import QtQuick 2.3
    
    
    Item {
        id: root
        visible: true
        width: 800
        height: 480
    
    
        Rectangle {
            id: background
            anchors.fill: parent
            smooth: true
    
        }
    
        
        Rectangle {
            id: button
            width: 200 ; height: 123
    
            anchors.centerIn: parent
    
            smooth: true
            radius: 8
    
            //color the button with a gradient
            gradient: Gradient {
                GradientStop {
                    position: 1.0
                    color: {
                        if (mouseArea.pressed)
                            return "red"
                        else
                            return "chartreuse"
                    }
                }
                GradientStop {position: 0.0; color: "paleturquoise" }
            }
    
    
            MouseArea {
                id:mouseArea
                anchors.fill: parent
                onPressed: {
                    //handler.turnOn()
                }
                onReleased: {
                   // handler.turnOff()
                }
    
            }
        }
    }
    
    
    
    

    UPDATE: When running this example with qmlviewer from terminal it works fast as expected (in that case have to use "import QtQuick 1.1" instead "2.3". When running with qmlscene from terminal or with QQuickView from C++ this app respond very bad on clicking button,


Log in to reply
 

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