<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QT6 hoverEnabled not working with an image]]></title><description><![CDATA[<p dir="auto">I have defined a simple Image that I want to rotate whenever someone hovers on it:</p>
<pre><code>RotationAnimator {
        id: rotationAnimator
        from: 0;
        to: 360;
        duration: 1000
        loops: Animation.Infinite
    }

          Image {
                    Layout.preferredWidth: parent.width / 3
                    Layout.preferredHeight: Layout.preferredWidth

                    id: options

                    Layout.alignment: Qt.AlignBottom

                    source: "../assets/options.png"
                    fillMode: Image.PreserveAspectFit

                    MouseArea{
                        anchors.fill: parent
                        hoverEnabled: true

                        Rectangle {
                            anchors.fill: parent
                            color: "red"
                            opacity: 0.2
                        }

                        onEntered:{
                            console.log("st");
                            rotationAnimator.target = parent;
                            rotationAnimator.running = true;
                        }

                        onExited:{
                            rotationAnimator.running = false;
                        }

                        onClicked:{
                            stackView.push("Options.qml");
                        }
                    }
                }
</code></pre>
<p dir="auto">It only rotates and prints whenever the left mouse button is pressed, despite hoverEnabled being set to true. Why? I also made rectangle to make sure the mousearea is correct and console.log to check if it's onEntered directly not working, and that's the case.</p>
]]></description><link>https://forum.qt.io/topic/151877/qt6-hoverenabled-not-working-with-an-image</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 10:53:56 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/151877.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Nov 2023 17:21:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QT6 hoverEnabled not working with an image on Sun, 05 Nov 2023 06:11:40 GMT]]></title><description><![CDATA[<p dir="auto">This works for me with Qt 6.5.3 on macOS.</p>
<pre><code>import QtQuick
import QtQuick.Window

Window {
    visible: true

    RotationAnimator {
            id: rotationAnimator
            from: 0;
            to: 360;
            duration: 1000
            loops: Animation.Infinite
            target: options
       }
    Image {
        id: options
        source: "https://ddgobkiprc33d.cloudfront.net/bfdb2533-84e9-45a1-956a-106722433d3f.png?v=ifu3inlhqv8"
        anchors.centerIn: parent

        MouseArea{
            anchors.fill: parent
            hoverEnabled: true
            onEntered: rotationAnimator.running = true
            onExited: rotationAnimator.running = false
        }
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/post/778789</link><guid isPermaLink="true">https://forum.qt.io/post/778789</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Sun, 05 Nov 2023 06:11:40 GMT</pubDate></item></channel></rss>