<?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[Modify hit box of QRadioButton (SE_RadioButtonClickRect)]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">currently I'm struggling with the following task: I want slightly increase the hit box around the QRadioButton. (The area where you can activate the button.)</p>
<p dir="auto">The "hit box" has several rules to fullfil in <a href="https://github.com/openwebos/qt/blob/master/src/gui/widgets/qradiobutton.cpp#L229" target="_blank" rel="noopener noreferrer nofollow ugc">QRadioButton::mouseMoveEvent</a> like underMouse or hitButton. The ClickRect is filled in <a href="https://github.com/openwebos/qt/blob/master/src/gui/styles/qstyleoption.cpp#L194" target="_blank" rel="noopener noreferrer nofollow ugc">QStyleOption::initFrom aka init</a> by using widget-&gt;rect(). Qt doc says in <a href="http://doc.qt.io/qt-5/qwidget.html#rect-prop" target="_blank" rel="noopener noreferrer nofollow ugc">QWidget::rect()</a>:<br />
<code>The rect property equals QRect(0, 0, width(), height()).</code><br />
Means that I only need to call for example <a href="http://doc.qt.io/qt-5/qwidget.html#setMinimumSize-1" target="_blank" rel="noopener noreferrer nofollow ugc">setMinimumSize</a>, <a href="http://doc.qt.io/qt-5/qwidget.html#setGeometry-1" target="_blank" rel="noopener noreferrer nofollow ugc">setGeometry</a> or <a href="http://doc.qt.io/qt-5/qwidget.html#resize-1" target="_blank" rel="noopener noreferrer nofollow ugc">resize</a> to increase it, <strong>but for me it doesn't work</strong> (from Qt4.7.X up to Qt5.X).</p>
<p dir="auto">I also derived QRadioButton and adjusted minimumSizeHint and sizeHint which doesn't had any impact towards the hit box.</p>
<p dir="auto">Any ideas?</p>
<p dir="auto">Kind regards,<br />
Mike</p>
]]></description><link>https://forum.qt.io/topic/85292/modify-hit-box-of-qradiobutton-se_radiobuttonclickrect</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 16:53:26 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/85292.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Nov 2017 07:16:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Modify hit box of QRadioButton (SE_RadioButtonClickRect) on Fri, 24 Nov 2017 06:25:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> yeah, it's kinda crystal ball, but at least I had no code which could provide more information than given above. ^^</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> You nailed it. That thing solved the topic in a very smooth way. <em>thumbs.up</em></p>
<p dir="auto">Kind regards,<br />
Mike</p>
]]></description><link>https://forum.qt.io/post/428027</link><guid isPermaLink="true">https://forum.qt.io/post/428027</guid><dc:creator><![CDATA[Lachrymology]]></dc:creator><pubDate>Fri, 24 Nov 2017 06:25:36 GMT</pubDate></item><item><title><![CDATA[Reply to Modify hit box of QRadioButton (SE_RadioButtonClickRect) on Fri, 24 Nov 2017 00:13:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
One way is</p>
<pre><code>#include &lt;QProxyStyle&gt;
class MyStyle : public QProxyStyle {
  virtual QRect subElementRect(SubElement subElement, const QStyleOption*opt , const QWidget* widget) const override {
    if ( subElement == SE_RadioButtonClickRect &amp;&amp; widget)
      return widget-&gt;rect();
    else
      return QProxyStyle::subElementRect( subElement,opt,widget) ;
  }
};


ui-&gt;radioButton-&gt;setStyle( new MyStyle );
</code></pre>
<p dir="auto"><img src="https://s33.postimg.org/bw5llry4f/drop.gif" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/428006</link><guid isPermaLink="true">https://forum.qt.io/post/428006</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Fri, 24 Nov 2017 00:13:02 GMT</pubDate></item><item><title><![CDATA[Reply to Modify hit box of QRadioButton (SE_RadioButtonClickRect) on Thu, 23 Nov 2017 23:37:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Can you show your code ? Without it it's pretty much "Crystal Ball Debugging".</p>
]]></description><link>https://forum.qt.io/post/428004</link><guid isPermaLink="true">https://forum.qt.io/post/428004</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 23 Nov 2017 23:37:17 GMT</pubDate></item></channel></rss>