<?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[mouseReleaseEvent not called only with Qt::RightButton]]></title><description><![CDATA[<p dir="auto"><strong>Solution</strong><br />
In my case, the <code>mouseReleaseEvent</code> was caught by another widget because  <code>mousePressEvent</code> with <code>Qt::RightButton</code> shows a menu at the clic position</p>
<hr />
<p dir="auto">Hi<br />
I have a Canvas class that looks like this :</p>
<pre><code>class Canvas : public QOpenGLWidget
{
// [...]

protected : 
    void mouseReleaseEvent(QMouseEvent* e) override {
        std::cout &lt;&lt; "mouseRelease called ";
        if (e-&gt;button() == Qt::RightButton) {
            std::cout &lt;&lt; "with right button" &lt;&lt; std::endl;
        } else if (e-&gt;button() == Qt::LeftButton) {
            std::cout &lt;&lt; "with left button" &lt;&lt; std::endl;
        }
        QOpenGLWidget::mouseReleaseEvent(e);
    }
// [...]
};
</code></pre>
<p dir="auto">Now when I</p>
<ul>
<li>left click into my canvas i get : <code>mouseRelease called with left button</code></li>
<li>right click into my canvas i get nothing (the method is not called)</li>
</ul>
<p dir="auto">I tried with both my laptop pad and my mouse, both give the same result.</p>
<p dir="auto">I could not reproduce the bug in a minimal example and his bug does not occur when i compile my project with Qt 5.6</p>
<p dir="auto">Any ideas ?</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/topic/112833/mousereleaseevent-not-called-only-with-qt-rightbutton</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 14:55:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/112833.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Mar 2020 11:31:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mouseReleaseEvent not called only with Qt::RightButton on Mon, 23 Mar 2020 13:56:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> The me knows these things thank you<br />
I have found the issue :<br />
On mousePressed with RightButton, a QMenu is shown. I am afraid that the mouseRelease was then caught by the menu instead of my canvas.</p>
]]></description><link>https://forum.qt.io/post/584174</link><guid isPermaLink="true">https://forum.qt.io/post/584174</guid><dc:creator><![CDATA[Ulysse]]></dc:creator><pubDate>Mon, 23 Mar 2020 13:56:54 GMT</pubDate></item><item><title><![CDATA[Reply to mouseReleaseEvent not called only with Qt::RightButton on Mon, 23 Mar 2020 12:21:57 GMT]]></title><description><![CDATA[<p dir="auto">The you have to minimize your program until it works.</p>
]]></description><link>https://forum.qt.io/post/584145</link><guid isPermaLink="true">https://forum.qt.io/post/584145</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 23 Mar 2020 12:21:57 GMT</pubDate></item><item><title><![CDATA[Reply to mouseReleaseEvent not called only with Qt::RightButton on Mon, 23 Mar 2020 12:03:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Right thank you<br />
It does not solve the problem though</p>
]]></description><link>https://forum.qt.io/post/584142</link><guid isPermaLink="true">https://forum.qt.io/post/584142</guid><dc:creator><![CDATA[Ulysse]]></dc:creator><pubDate>Mon, 23 Mar 2020 12:03:07 GMT</pubDate></item><item><title><![CDATA[Reply to mouseReleaseEvent not called only with Qt::RightButton on Mon, 23 Mar 2020 11:38:07 GMT]]></title><description><![CDATA[<p dir="auto">You should call the base class impl of mousePress/ReleaseEvent() functions.</p>
]]></description><link>https://forum.qt.io/post/584139</link><guid isPermaLink="true">https://forum.qt.io/post/584139</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 23 Mar 2020 11:38:07 GMT</pubDate></item></channel></rss>