<?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[Using QFont]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">I'm trying to change the ui's labels' fonts with code. I have a variable which saves the new font size, for example:</p>
<pre><code>int labelSize = 12;
ui-&gt;label-&gt;font().setPointSize(labelSize);
</code></pre>
<p dir="auto">But I have the following error:</p>
<p dir="auto">'void QFont::setPointSize(int)' : cannot convert 'this' pointer from 'const QFont' to 'QFont &amp;'</p>
<p dir="auto">and I don't know how to fix it.</p>
<p dir="auto">Thank you very much!!</p>
]]></description><link>https://forum.qt.io/topic/79879/using-qfont</link><generator>RSS for Node</generator><lastBuildDate>Thu, 18 Jun 2026 07:23:37 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/79879.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Jun 2017 09:55:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using QFont on Fri, 02 Jun 2017 11:44:05 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Technically it should rather be:</p>
<pre><code>QFont font = m_label-&gt;font();
font.setPointSize(50);
m_label-&gt;setFont(font);
</code></pre>
<p dir="auto">So you are always sure to modify the font from a given widget which might have bee changed elsewhere.</p>
]]></description><link>https://forum.qt.io/post/396993</link><guid isPermaLink="true">https://forum.qt.io/post/396993</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 02 Jun 2017 11:44:05 GMT</pubDate></item><item><title><![CDATA[Reply to Using QFont on Fri, 02 Jun 2017 10:18:52 GMT]]></title><description><![CDATA[<p dir="auto">HI <a class="plugin-mentions-user plugin-mentions-a" href="/user/ivanicy">@<bdi>ivanicy</bdi></a></p>
<p dir="auto">Welcome,</p>
<p dir="auto">Thanks,</p>
]]></description><link>https://forum.qt.io/post/396985</link><guid isPermaLink="true">https://forum.qt.io/post/396985</guid><dc:creator><![CDATA[Pradeep Kumar]]></dc:creator><pubDate>Fri, 02 Jun 2017 10:18:52 GMT</pubDate></item><item><title><![CDATA[Reply to Using QFont on Fri, 02 Jun 2017 10:13:43 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much!!</p>
]]></description><link>https://forum.qt.io/post/396984</link><guid isPermaLink="true">https://forum.qt.io/post/396984</guid><dc:creator><![CDATA[ivanicy]]></dc:creator><pubDate>Fri, 02 Jun 2017 10:13:43 GMT</pubDate></item><item><title><![CDATA[Reply to Using QFont on Fri, 02 Jun 2017 10:07:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ivanicy">@<bdi>ivanicy</bdi></a></p>
<p dir="auto">can u try</p>
<pre><code>int fontsize = 50;

QFont font;
font.setPointSize(fontsize);

m_label = new QLabel;
m_label-&gt;setText("Hello");
m_label-&gt;setFont(font);
</code></pre>
<p dir="auto">Thanks,</p>
]]></description><link>https://forum.qt.io/post/396983</link><guid isPermaLink="true">https://forum.qt.io/post/396983</guid><dc:creator><![CDATA[Pradeep Kumar]]></dc:creator><pubDate>Fri, 02 Jun 2017 10:07:23 GMT</pubDate></item></channel></rss>