<?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[Move Mouse when tab clicked on keyboard]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">Quick question - is there anyway that when the tab button is clicked on the keyboard, you can set the mouse position to the location of the tab focus that was set by tabbing through a QWidget? For example, if I have 5 rows. As I tab, not only should the focus change, the mouse will move to the row that has the focus. I'm sure I need to use the OnKeyEvent Class. I will also want this functionality to be used inherently by multiple QWidgets. Thank you ahead of time for any input you may have!</p>
]]></description><link>https://forum.qt.io/topic/69427/move-mouse-when-tab-clicked-on-keyboard</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 09:28:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/69427.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jul 2016 13:34:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Wed, 20 Jul 2016 05:46:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/huntermetcalfe">@<bdi>HunterMetcalfe</bdi></a> said:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> Quick question again. So I have a QWidget that is made up of other QWidgets. For BaseClass:: would that perhaps just be QWidget or would it be the Widget that contains that widget.</p>
</blockquote>
<p dir="auto">What i meant is that you need to subclass every widget type and reimplement this method for every widget (and parent widget) you'd like to see this behavior.</p>
<p dir="auto">So if you only want it to happen for a certain container, every child widget of the container has to have this method reimplemented.</p>
]]></description><link>https://forum.qt.io/post/338454</link><guid isPermaLink="true">https://forum.qt.io/post/338454</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 20 Jul 2016 05:46:09 GMT</pubDate></item><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Tue, 19 Jul 2016 18:50:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/huntermetcalfe">@<bdi>HunterMetcalfe</bdi></a> said:</p>
<ul>
<li>This may be a noob question, but how do you paste a picture<br />
Hi,<br />
you must upload to a site and get link to paste here.<br />
Forum dont allow directly :)</li>
</ul>
]]></description><link>https://forum.qt.io/post/338397</link><guid isPermaLink="true">https://forum.qt.io/post/338397</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 19 Jul 2016 18:50:48 GMT</pubDate></item><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Tue, 19 Jul 2016 14:43:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> This may be a noob question, but how do you paste a picture into this forum? I can send you a picture to elaborate more.</p>
]]></description><link>https://forum.qt.io/post/338365</link><guid isPermaLink="true">https://forum.qt.io/post/338365</guid><dc:creator><![CDATA[HunterMetcalfe]]></dc:creator><pubDate>Tue, 19 Jul 2016 14:43:02 GMT</pubDate></item><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Tue, 19 Jul 2016 14:31:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> Quick question again. So I have a QWidget that is made up of other QWidgets. For BaseClass:: would that perhaps just be QWidget or would it be the Widget that contains that widget. (Sorry for the confusing language). I think this is what you were saying for the caveat.</p>
]]></description><link>https://forum.qt.io/post/338363</link><guid isPermaLink="true">https://forum.qt.io/post/338363</guid><dc:creator><![CDATA[HunterMetcalfe]]></dc:creator><pubDate>Tue, 19 Jul 2016 14:31:09 GMT</pubDate></item><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Tue, 19 Jul 2016 13:50:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> Thank you so much for the response. I will begin working on that and work with the caveat that you have mentioned! I appreciate your help! I will let you know the results.</p>
]]></description><link>https://forum.qt.io/post/338358</link><guid isPermaLink="true">https://forum.qt.io/post/338358</guid><dc:creator><![CDATA[HunterMetcalfe]]></dc:creator><pubDate>Tue, 19 Jul 2016 13:50:00 GMT</pubDate></item><item><title><![CDATA[Reply to Move Mouse when tab clicked on keyboard on Tue, 19 Jul 2016 13:45:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/huntermetcalfe">@<bdi>HunterMetcalfe</bdi></a></p>
<pre><code>QCursor::setPos( widget-&gt;mapToGlobal( widget-&gt;rect().center() ) );
</code></pre>
<p dir="auto">As starting point you can reimplement focusNextPrevChild(bool) method (which will be called when the focus should be set to the next/previous widget when TAB/BACKTAB is pressed).</p>
<pre><code>bool MyWidget::focusNextPrevChild( bool next )
{
       bool result = BaseClass::focusNextPrevChild( next );
       if( result )
       {
            if( QWidget* widget = QApplication::focusWidget() )
                QCursor::setPos( widget-&gt;mapToGlobal( widget-&gt;rect().center() ) );
       }
       return result;
}
</code></pre>
<p dir="auto">The caveat is that this has to be done for every widget type. Thus you may want to write this code into a macro (with base class parameter) instead?</p>
]]></description><link>https://forum.qt.io/post/338356</link><guid isPermaLink="true">https://forum.qt.io/post/338356</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 19 Jul 2016 13:45:37 GMT</pubDate></item></channel></rss>