<?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[Requires 2 right clicks to switch context menus among items?]]></title><description><![CDATA[<p dir="auto">Code below with Qt 5.3.0 x64 opengl on windows 7</p>
<p dir="auto">@#include &lt;QtWidgets&gt;<br />
#include &lt;QGLWidget&gt;</p>
<p dir="auto">int main(int argc, char *argv[])<br />
{<br />
QApplication a(argc, argv);<br />
QMainWindow w;</p>
<pre><code>w.setCentralWidget(new QGLWidget(&amp;w));

QTreeWidget* tree = new QTreeWidget(&amp;w);
QTreeWidgetItem* item0 = 
    new QTreeWidgetItem(tree, QStringList("a"));
QTreeWidgetItem* item1 = 
    new QTreeWidgetItem(tree, QStringList("b"));
tree-&gt;setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(
    tree,
    &amp;QTreeView::customContextMenuRequested,
    [&amp;](){
        QMenu menu;
        menu.addAction("a");
        menu.exec&amp;#40;QCursor::pos(&amp;#41;&amp;#41;;
}&amp;#41;;

QDockWidget* dock = new QDockWidget("Tree", &amp;w&amp;#41;;
dock-&gt;setWidget(tree&amp;#41;;
w.addDockWidget(Qt::LeftDockWidgetArea, dock&amp;#41;;

w.show(&amp;#41;;
return a.exec(&amp;#41;;
</code></pre>
<p dir="auto">}@</p>
<p dir="auto">Compile and run it. It requires 2 right clicks to switch context menus among items. However, if I change QGLWidget to QWidget. It is fine. 1 right click can switch context menus among items. Any bugs??? Thanks a lot.</p>
<p dir="auto">Some observations: Switch the positions of the tree and the GL widget is ok, i.e. set the tree as the central widget and GL Widget as the one in the dock.</p>
<p dir="auto">More findings. When the widow is maximized. The issue is gone. When the widow is aligned with the left-top corner of the desktop screen, the issue is also gone. Thus, I think the bug is a mis-calculation of the mouse position when mapping to/from different widgets with dock widgets involved.</p>
<p dir="auto">Hope to see it corrected in the next Qt release.</p>
]]></description><link>https://forum.qt.io/topic/43010/requires-2-right-clicks-to-switch-context-menus-among-items</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 15:59:47 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/43010.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 27 Jun 2014 04:11:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Wed, 30 Jul 2014 00:28:43 GMT]]></title><description><![CDATA[<p dir="auto">More findings. When the widow is maximized. The issue is gone. When the widow is aligned with the left-top corner of the desktop screen, the issue is also gone. Thus, I think the bug is a mis-calculation of the mouse position when mapping to/from different widgets with dock widgets involved.</p>
<p dir="auto">Hope to see it corrected in the next Qt release.</p>
]]></description><link>https://forum.qt.io/post/237758</link><guid isPermaLink="true">https://forum.qt.io/post/237758</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 30 Jul 2014 00:28:43 GMT</pubDate></item><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Sat, 28 Jun 2014 21:24:12 GMT]]></title><description><![CDATA[<p dir="auto">You may have found something. You should check the "bug report system":<a href="http://bugreports.qt-project.org" target="_blank" rel="noopener noreferrer nofollow ugc">http://bugreports.qt-project.org</a> to see if it's something known. If not please consider opening a new report providing a minimal compilable project (your main + the corresponding pro file in a zip file)</p>
]]></description><link>https://forum.qt.io/post/233853</link><guid isPermaLink="true">https://forum.qt.io/post/233853</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 28 Jun 2014 21:24:12 GMT</pubDate></item><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Sat, 28 Jun 2014 20:19:25 GMT]]></title><description><![CDATA[<p dir="auto">Try it on Qt5.3.1 widows 7 x64. Still has the same problem. :(</p>
]]></description><link>https://forum.qt.io/post/233850</link><guid isPermaLink="true">https://forum.qt.io/post/233850</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sat, 28 Jun 2014 20:19:25 GMT</pubDate></item><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Sat, 28 Jun 2014 19:54:11 GMT]]></title><description><![CDATA[<p dir="auto">Can you test the same thing with 5.3.1 ?</p>
<p dir="auto">I can't reproduce it on OS X</p>
]]></description><link>https://forum.qt.io/post/233846</link><guid isPermaLink="true">https://forum.qt.io/post/233846</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 28 Jun 2014 19:54:11 GMT</pubDate></item><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Sat, 28 Jun 2014 02:53:08 GMT]]></title><description><![CDATA[<p dir="auto">Thanks. Added. Qt 5.3.0 X64 OpenGL + Windows 7 64 bit</p>
]]></description><link>https://forum.qt.io/post/233790</link><guid isPermaLink="true">https://forum.qt.io/post/233790</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sat, 28 Jun 2014 02:53:08 GMT</pubDate></item><item><title><![CDATA[Reply to Requires 2 right clicks to switch context menus among items? on Fri, 27 Jun 2014 22:30:42 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">You should also add which version of Qt you are using as well as the OS you are running on</p>
]]></description><link>https://forum.qt.io/post/233774</link><guid isPermaLink="true">https://forum.qt.io/post/233774</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 27 Jun 2014 22:30:42 GMT</pubDate></item></channel></rss>