Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. MouseArea.hoverEnabled not working?
Qt 6.12 LTS is out! See what's new in the release blog

MouseArea.hoverEnabled not working?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 7.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    id:simplebutton
    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      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?

      Regards,
      Michael

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved