<?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[DragHandler::onDragChanged not reporting continously]]></title><description><![CDATA[<p dir="auto">When performing a drag in a QML widget that captures events using a DragHandler, (click and move the mouse), the action is not registered until dragging is finished (unclick the mouse).<br />
Dragging should register intermediary movements (while you're moving the mouse).</p>
<p dir="auto">Video demonstrating this issue: <a href="https://gitlab.com/advanced-effects/Advanced-Effects/-/work_items/51#note_3556028185" target="_blank" rel="noopener noreferrer nofollow ugc">https://gitlab.com/advanced-effects/Advanced-Effects/-/work_items/51#note_3556028185</a></p>
<p dir="auto">Relevant code:</p>
<pre><code class="language-qml">        ApplicationCanvas {
                DragHandler {
                        onGrabChanged: (transition, event) =&gt; appCanvas.onGrabChanged(transition, event)
                        onCanceled: (event) =&gt; appCanvas.onCanceled(event)
                }
</code></pre>
<p dir="auto">Code receiving input: <a href="https://gitlab.com/advanced-effects/Advanced-Effects/-/blob/main/src/canvas/view/viewlayers/selection_viewlayer.cpp?ref_type=heads#L132" target="_blank" rel="noopener noreferrer nofollow ugc">https://gitlab.com/advanced-effects/Advanced-Effects/-/blob/main/src/canvas/view/viewlayers/selection_viewlayer.cpp?ref_type=heads#L132</a></p>
<pre><code class="language-cpp">void SelectionViewLayer::on_grab_changed(QPointingDevice::GrabTransition transition,
                                         QEventPoint event)
{
        cancel_user_selection_area();
        if (toolCtx()-&gt;selectedTool != ToolIdentifier::selection) {
                selectedObjects()-&gt;clear_all_objects();
                return;
        };

        QRectF drag_area = interactable.get_normalized_drag_area(event);

        /* Middle man work .... */

        // Finally update selection area
        m_user_selection_area = drag_area;
        update_selected_objects(m_user_selection_area);
};
</code></pre>
]]></description><link>https://forum.qt.io/topic/164888/draghandler-ondragchanged-not-reporting-continously</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 09:54:52 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164888.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Jul 2026 09:08:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Tue, 21 Jul 2026 06:51:11 GMT]]></title><description><![CDATA[<p dir="auto">You're welcome!</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kaixoo">@<bdi>kaixoo</bdi></a> said in <a href="/post/839246">DragHandler::onDragChanged not reporting continously</a>:</p>
<blockquote>
<p dir="auto">I'm also looking to register when the user clicks the middle mouse button + drags their mouse. DragHandler only registers events from the left click</p>
</blockquote>
<p dir="auto">Set your <code>acceptedButtons</code>: <a href="https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop</a></p>
<blockquote>
<p dir="auto">I see now that <code>handlerPoint</code> has no signals though, how am I supposed to signal when the position has changed?</p>
</blockquote>
<p dir="auto"><code>handlerPoint</code> is a <strong>value type</strong>, like <code>date</code> or <code>string</code>. The string doesn't emit a signal either when a character gets modified. Rather, the whole value gets updated.</p>
<p dir="auto">Putting these together:</p>
<pre><code>DragHandler {
    acceptedButtons: Qt.MiddleButton
    onCentroidChanged: {
        if (active)
            console.log("Centroid moved to", centroid.position)
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/post/839261</link><guid isPermaLink="true">https://forum.qt.io/post/839261</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Tue, 21 Jul 2026 06:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Fri, 31 Jul 2026 11:11:19 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Set your acceptedButtons: <a href="https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop</a></p>
</blockquote>
<p dir="auto">So, with this, should I have a different DragHandler for every possible button I want to accept, and emit different signals? That seems like spaghetti code. Is there a way to pass which button is being pressed while the drag is happening?</p>
<p dir="auto">Something along the lines of:</p>
<pre><code class="language-qml">DragHandler {
   onDragChanged: { parentWidget.onDragChangedCallback(event, buttonPressed) }
}
</code></pre>
<p dir="auto">Where <code>buttonPressed</code> may be the Right Mouse Button, the Left Mouse Button, or Middle Mouse Button.</p>
<p dir="auto">Now I'm also using <code>onCentroidChanged</code> and passing <code>centroid.position</code>. However, that only provides 1 position (the current position). Do I need to manually register the initial position? Or is there a way, like in onDragChanged, where I can pull the initial and last positions? It seems like onDragChanged is only being called when the drag is finished.</p>
]]></description><link>https://forum.qt.io/post/839476</link><guid isPermaLink="true">https://forum.qt.io/post/839476</guid><dc:creator><![CDATA[kaixoo]]></dc:creator><pubDate>Fri, 31 Jul 2026 11:11:19 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Tue, 21 Jul 2026 06:51:11 GMT]]></title><description><![CDATA[<p dir="auto">You're welcome!</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kaixoo">@<bdi>kaixoo</bdi></a> said in <a href="/post/839246">DragHandler::onDragChanged not reporting continously</a>:</p>
<blockquote>
<p dir="auto">I'm also looking to register when the user clicks the middle mouse button + drags their mouse. DragHandler only registers events from the left click</p>
</blockquote>
<p dir="auto">Set your <code>acceptedButtons</code>: <a href="https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-draghandler.html#acceptedButtons-prop</a></p>
<blockquote>
<p dir="auto">I see now that <code>handlerPoint</code> has no signals though, how am I supposed to signal when the position has changed?</p>
</blockquote>
<p dir="auto"><code>handlerPoint</code> is a <strong>value type</strong>, like <code>date</code> or <code>string</code>. The string doesn't emit a signal either when a character gets modified. Rather, the whole value gets updated.</p>
<p dir="auto">Putting these together:</p>
<pre><code>DragHandler {
    acceptedButtons: Qt.MiddleButton
    onCentroidChanged: {
        if (active)
            console.log("Centroid moved to", centroid.position)
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/post/839261</link><guid isPermaLink="true">https://forum.qt.io/post/839261</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Tue, 21 Jul 2026 06:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Mon, 20 Jul 2026 14:40:20 GMT]]></title><description><![CDATA[<p dir="auto">Thanks! I see now that <code>handlerPoint</code> has no signals though, how am I supposed to signal when the position has changed?</p>
<p dir="auto">More generally, I'm also looking to register when the user clicks the middle mouse button + drags their mouse. DragHandler only registers events from the left click, is there a way I can generalize all this? Perhaps tracking the mouse position + the clicks separately? (<code>HoverHandler</code> + <code>WheelHandler</code> + <code>Keys.onPressed</code>?)</p>
]]></description><link>https://forum.qt.io/post/839246</link><guid isPermaLink="true">https://forum.qt.io/post/839246</guid><dc:creator><![CDATA[kaixoo]]></dc:creator><pubDate>Mon, 20 Jul 2026 14:40:20 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Sat, 18 Jul 2026 22:52:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kaixoo">@<bdi>kaixoo</bdi></a> said in <a href="/post/839216">DragHandler::onDragChanged not reporting continously</a>:</p>
<blockquote>
<p dir="auto">Where is <code>centroid</code> documented btw? It's only mentioned 3 times in <code>DragHandler</code>'s doc page and only with some code examples, without showing a reference for the full type.</p>
</blockquote>
<p dir="auto">The full type is <a href="https://doc.qt.io/qt-6/qml-qtquick-handlerpoint.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-handlerpoint.html</a></p>
<p dir="auto"><code>centroid</code> is inherited from <code>MultiPointHandler</code>: <a href="https://doc.qt.io/qt-6/qml-qtquick-multipointhandler.html#centroid-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-multipointhandler.html#centroid-prop</a></p>
<p dir="auto">To navigate there from the <code>DragHandler</code> doc page, click on <em>"List of all members, including inherited members"</em> which goes to see <a href="https://doc.qt.io/qt-6/qml-qtquick-draghandler-members.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-draghandler-members.html</a></p>
]]></description><link>https://forum.qt.io/post/839217</link><guid isPermaLink="true">https://forum.qt.io/post/839217</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Sat, 18 Jul 2026 22:52:08 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Sat, 18 Jul 2026 20:51:43 GMT]]></title><description><![CDATA[<p dir="auto">Ohhh, I see. Thank you!<br />
Where is <code>centroid</code> documented btw? It's only mentioned 3 times in <code>DragHandler</code>'s doc page and only with some code examples, without showing a reference for the full type.</p>
]]></description><link>https://forum.qt.io/post/839216</link><guid isPermaLink="true">https://forum.qt.io/post/839216</guid><dc:creator><![CDATA[kaixoo]]></dc:creator><pubDate>Sat, 18 Jul 2026 20:51:43 GMT</pubDate></item><item><title><![CDATA[Reply to DragHandler::onDragChanged not reporting continously on Wed, 15 Jul 2026 12:35:03 GMT]]></title><description><![CDATA[<p dir="auto">If you want to react to a drag move, you need a signal handler on the <code>DragHandler</code>'s <code>centroid.positionChanged</code>.<br />
<code>grabChanged</code> is only emitted when starting or stopping a drag.</p>
]]></description><link>https://forum.qt.io/post/839165</link><guid isPermaLink="true">https://forum.qt.io/post/839165</guid><dc:creator><![CDATA[GrecKo]]></dc:creator><pubDate>Wed, 15 Jul 2026 12:35:03 GMT</pubDate></item></channel></rss>