<?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[QShortcut and fullscreen QWidget issue]]></title><description><![CDATA[<p dir="auto">I have a <code>QMainWindow</code> with multiple <code>QDockWidget</code>s. Those dock widgets hold different <code>QWidget</code> based classes in them. For the sake of context: One of the docks contains a text editor widget. The text editor obviously uses keyboard input to modify the text content. However, that widget also uses <code>QShortcut</code>s to toggle the visibility of the search bar (Ctrl+F) and similar.</p>
<p dir="auto">What I am trying to add to my application is a <code>QShortcut</code> that allows the user making the currently focused <code>QDockWidget</code> become fullscreen temporarily. I added a new <code>QShortcut</code> and the corresponding slot-code to the <code>QMainWindow</code> class. So far everything works great: Pressing the key combination Ctrl+Alt+F will make the dock become fullscreen, pressing it again will put it back where it was before.<br />
However, my problem is that once the dock became fullscreen and I start clicking and typing around in the dock's widget (eg. that text editor), the key combination to make the dock leave the fullscreen mode no longer works.</p>
<p dir="auto">Does anybody have an idea what the issue is? The <code>QShortcut</code> in the <code>QMainWindow</code> has been configured to use <code>Qt::ApplicationShortcut</code> so I don't believe that it's a focus problem - yet the slot simply never gets called.</p>
<pre><code>QShortcut* shortcutToggleFullscreenCurrentDock = new QShortcut(this);
shortcutToggleFullscreenCurrentDock-&gt;setContext(Qt::ApplicationShortcut);
shortcutToggleFullscreenCurrentDock-&gt;setKey(ShortcutSequences::fullscreenCurrentDock());
connect(shortcutToggleFullscreenCurrentDock, &amp;QShortcut::activated, this, &amp;MainWindow::dockToggleShowFullscreen);
</code></pre>
<p dir="auto">I'd be thankful for any kind of hint/tipp.</p>
]]></description><link>https://forum.qt.io/topic/73008/qshortcut-and-fullscreen-qwidget-issue</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 15:52:26 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/73008.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Nov 2016 10:15:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QShortcut and fullscreen QWidget issue on Fri, 04 Nov 2016 11:03:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> said in <a href="/post/357928">QShortcut and fullscreen QWidget issue</a>:</p>
<blockquote>
<p dir="auto">try also (additionally) to connect to the activatedAmbiguously() signal</p>
</blockquote>
<p dir="auto">That appears to be the trick! I haven't tested it with all the possible corner cases but so far it appears to be working nicely! Thank you very much for your help.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m.sue">@<bdi>m.sue</bdi></a> said in <a href="/topic/73008/qshortcut-and-fullscreen-qwidget-issue/3">QShortcut and fullscreen QWidget issue</a>:</p>
<blockquote>
<p dir="auto">I assume a text editor (that has the focus) thinks that all keyboard events (like pressing character keys or CTRL-C, CTRL-V) are meant for it and swallows them. It does not delegate them to the parent widget.</p>
</blockquote>
<p dir="auto">That is correct - but what do I have to do in order to still set up a truly application wide shortcut?<br />
I would have assume that shortcuts that the text editor doesn't know (eg. ALT + CTRL + F in my case) will simply be ignored and thus forwarded to the parent.</p>
]]></description><link>https://forum.qt.io/post/357935</link><guid isPermaLink="true">https://forum.qt.io/post/357935</guid><dc:creator><![CDATA[Joel Bodenmann]]></dc:creator><pubDate>Fri, 04 Nov 2016 11:03:14 GMT</pubDate></item><item><title><![CDATA[Reply to QShortcut and fullscreen QWidget issue on Fri, 04 Nov 2016 10:37:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I assume a text editor (that has the focus) thinks that all keyboard events (like pressing character keys or CTRL-C, CTRL-V) are meant for it and swallows them. It does not delegate them to the parent widget.<br />
-Michael.</p>
]]></description><link>https://forum.qt.io/post/357933</link><guid isPermaLink="true">https://forum.qt.io/post/357933</guid><dc:creator><![CDATA[m.sue]]></dc:creator><pubDate>Fri, 04 Nov 2016 10:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to QShortcut and fullscreen QWidget issue on Fri, 04 Nov 2016 10:27:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joel-bodenmann">@<bdi>Joel-Bodenmann</bdi></a> said in <a href="/post/357925">QShortcut and fullscreen QWidget issue</a>:</p>
<blockquote>
<p dir="auto">connect(shortcutToggleFullscreenCurrentDock, &amp;QShortcut::activated, this, &amp;MainWindow::dockToggleShowFullscreen);</p>
</blockquote>
<p dir="auto">try also (additionally) to connect to the <code>activatedAmbiguously()</code> signal</p>
]]></description><link>https://forum.qt.io/post/357928</link><guid isPermaLink="true">https://forum.qt.io/post/357928</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Fri, 04 Nov 2016 10:27:57 GMT</pubDate></item></channel></rss>