MouseArea.hoverEnabled not working?

  • Hi,

    I am new to QML and am just starting to go through the tutorials. I am experienced in Qt so I know hove the mouse hover attribute affects mouse events so I am wondering why this code sample below doesn't change the rectangle color without pressing/holding down a mouse button?

    Either I'm really blind and not seeing the issue or it is hoverEnabled that is not working. I am using Nokia SDK 1.0.2 (with its Qt 4.7.0).

    import Qt 4.7

    Rectangle {
    width: 300
    height: 100
    border.width: 5

    property color onHoverColor: "yellow"
    property color defaultColor: "blue"

    MouseArea {
    id: buttonMouseArea
    anchors.fill: parent
    hoverEnabled: true
    onEntered: parent.border.color = onHoverColor
    onExited: parent.border.color = defaultColor

    Thanks for any help.

  • Hi,

    The above code should be working -- it all looks correct (and is working fine for me on OS X, using HEAD). I'm not sure if this is a bug that has already been fixed, or a platform specific issue -- what platform are you using?


  • Do you run this code in Nokia Simulator? hoverEnabled thingy works perfectly for me in qmlviewer.

  • The example is running with QDeclarativeView in the Symbian simulator under Linux (Ubuntu 10.10). I think that strekazoid is on the right track with his comment. The simulator is probably simulating a phone touchscreen which doesn't know your "mouse" (i.e. finger) position until the screen is actually touched. Consequentially, hovering cannot exist on those devices.

Log in to reply

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