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

Performance issues with QML MouseArea events

    XMLWordPrintable

Details

    Description

      The MouseArea of certain positioning components such as Grid seems to cause performance issues.

      The following QML application shows the problem: high CPU load, especially during interactions via the touchscreen.
      Just animating the grid element shows about 15% CPU load, additionally pressing & holding a grid element shows about 40% load.

      In a more complex application we want to do some drag and drop operation combined with some animation: but moving a grid element while animating the others is nearly impossible (the CPU load rises up to 99%).

      import QtQuick 2.2
      
      Rectangle {
          color: "white"
          width: 320
          height: 480
          Grid {
              x: 10
              y: 10
              columnSpacing: 10
              rowSpacing: 10
              columns: 3
              Repeater {
                  model: 12
                  Rectangle {
                      id: rect
                      width: 90
                      height: 90
                      color: "dodgerblue"
                      smooth: true
                      antialiasing: true
                      Text {
                          text: qsTr("Icon")
                          anchors.centerIn: parent
                      }
                      SequentialAnimation on rotation {
                          id: rotate
                          NumberAnimation { to:  2; duration: 60 }
                          NumberAnimation { to: -2; duration: 120 }
                          NumberAnimation { to:  0; duration: 60 }
                          loops: Animation.Infinite
                          alwaysRunToEnd: true
                          running: false
                      }
                      MouseArea {
                          anchors.fill: parent
                          onPressed: {
                              if(rotate.running==true) rotate.stop();
                              else rotate.start();
                          }
                      }
                      Component.onCompleted: rotate.start();
                  }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            taferl Bernd Schöfmann
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes