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

States property changes on mouse hover way not be completely reset

    XMLWordPrintable

Details

    • 05f3920562e7a718492bed61a48c0058b65a0d5d

    Description

      Sorry for the possibly unclear summary.

      === Steps to reproduce ===

      1. Launch the following code in qmlviewer:

      import QtQuick 1.0
      
      Rectangle {
          width: 200
          height: 200
      
          Rectangle {
              id: rect
              width: 100
              height: 30
              anchors.centerIn: parent
              color: "red"
              Behavior on color { ColorAnimation {duration: 200}}
      
              MouseArea {
                  id: mouseArea
                  anchors.fill:parent
                  hoverEnabled: true
              }
      
              states: State {
                      name: "hover"
                      when: mouseArea.containsMouse
                      PropertyChanges {target: rect; color: "yellow"}
                  }
          }
      }
      

      2. Move the mouse quickly several times over the red rectangle. At some point, the rectangle will keep some orange color when the mouse is not hover it, instead of being fully reset to red

      3. Expected result: the rectangle should be fully reset to it's default state when the hover state isn't acitvated. Ie: it should be red.

      4. Workaround: use property bindings instead of state. Thus, if we define the rectangle color as:

      color: mouseArea.containsMouse ? "yellow" : "red"
      

      and remove the state, it will work as expected.

      Attachments

        Issue Links

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

          Activity

            People

              brasser Michael Brasser (closed Nokia identity) (Inactive)
              gregschlom Gregory Schlomoff
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes