<?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[Font properties and stylesheets in the Designer]]></title><description><![CDATA[<p dir="auto">I have some difficulties to understand the behavior of fonts and stylesheets in the Designer<br />
Here is an example</p>
<p dir="auto">I add a label and a Tab Widget<br />
<img src="https://ddgobkiprc33d.cloudfront.net/5caf5b06-634b-4672-92ab-b2193861788e.png" alt="a1749334-c28a-49c4-a5de-520ed305c24a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Apply a vertical layout<br />
<img src="https://ddgobkiprc33d.cloudfront.net/5465dbb0-5f06-419b-91ad-cb31d2b2dbfc.png" alt="c62c5353-06f2-42dd-90f9-708eb82d715f-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Change text and properties of the top label<br />
<img src="https://ddgobkiprc33d.cloudfront.net/68ae2606-a341-4666-b5a3-0801b093530c.png" alt="4a317008-94a8-434f-9c2e-2cccedd31e7a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Change Font size property of the Tab Widget to 12<br />
<img src="https://ddgobkiprc33d.cloudfront.net/8ead0bf9-16ff-46ec-b09f-a1ada1c50637.png" alt="fadf453e-82b1-4209-bf80-c5e07096bb22-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Add a label to Tab 1 page and another below the Tab Widget<br />
<img src="https://ddgobkiprc33d.cloudfront.net/7282b329-79d0-4ca6-b8e5-bd8d9f25ef09.png" alt="69d35112-3495-4147-92f2-84f6bd458e5b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>My first question</strong><br />
Why is the font size of the Label on the Tab Widget automatically changed to 12, the same size as for the text in the tabs<br />
<img src="https://ddgobkiprc33d.cloudfront.net/c94ac720-72c7-44ef-b25a-f8e8d021de0e.png" alt="290dade9-2ce0-44a9-88bc-8937e7a4ffb3-image.png" class=" img-fluid img-markdown" /><br />
and the label outside the Tab Widget keeps the default size<br />
<img src="https://ddgobkiprc33d.cloudfront.net/ba64f719-5e4f-4594-ba6e-d08109499744.png" alt="58d9c218-c398-45e0-afa0-3fdc3f408a7b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I was expecting that the label added to Tab 1 would also feature the default size of 8</p>
<p dir="auto">Now I add a few other Labels and a vertical layout to the Tab 1 page<br />
<img src="https://ddgobkiprc33d.cloudfront.net/6c38d312-976b-4e81-aa1a-69ae8d978334.png" alt="7ed69335-e59a-4caf-a21e-87aa8c16f93d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I would like that the text in all labels in the Tab Widget are centered using Stylesheets<br />
From the documentation I know that {text-align: center} is not supported for labels, but I found a post on this forum explaining that the following is working<br />
QLabel {qproperty-alignment: AlignCenter;}</p>
<p dir="auto">So I right click on the tabs to open the Stylesheet window and add the above code<br />
<img src="https://ddgobkiprc33d.cloudfront.net/04939bbe-f216-4b6d-80c8-4c820835ccec.png" alt="72b74f81-f06a-45fd-994c-21c65a3485a2-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">When I click Apply all the labels are centered as expected<br />
<img src="https://ddgobkiprc33d.cloudfront.net/9d4f61c7-2dfc-4e0e-adbc-0bd4315e31f0.png" alt="acb2e8f7-c392-48f2-b17e-6f67cf338209-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">But when I close the Stylesheet window the font size of the labels is set to the default value 8.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/b2127b76-2524-4793-9c85-f1a1d9074627.png" alt="5407ba50-af4b-4485-92be-10c58cf291e7-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>Why?</strong></p>
<p dir="auto">Worse, when I run the application the labels are even not centered<br />
<img src="https://ddgobkiprc33d.cloudfront.net/73ac1a5f-a0ab-48d6-a807-a2338d227f07.png" alt="9ab05f10-fe00-487c-bab1-6d1720706e8d-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/130213/font-properties-and-stylesheets-in-the-designer</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 01:28:59 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/130213.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Sep 2021 20:18:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Font properties and stylesheets in the Designer on Fri, 10 Sep 2021 20:31:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bert59">@<bdi>Bert59</bdi></a> said in <a href="/post/680122">Font properties and stylesheets in the Designer</a>:</p>
<blockquote>
<p dir="auto">Change Font size property of the Tab Widget to 12</p>
</blockquote>
<p dir="auto">Change Font size property of the Tab Widget to 12 &lt;== for all contents in tab widget including all TextLabels.<br />
if you want to change the font of text labels, you can set different font size to them separately.<br />
QLabel has func setFont()</p>
<pre><code>Label {
    text: "Hello world"
    font.pixelSize: 22 &lt;========
    font.italic: true
    color: "steelblue"
}
</code></pre>
]]></description><link>https://forum.qt.io/post/680123</link><guid isPermaLink="true">https://forum.qt.io/post/680123</guid><dc:creator><![CDATA[JoeCFD]]></dc:creator><pubDate>Fri, 10 Sep 2021 20:31:54 GMT</pubDate></item></channel></rss>