<?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[Customize QDoubleSpinBox text align with CSS]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I try to customize a double spin box.</p>
<p dir="auto">In Qt designer I have the following lines in the style sheet editor.</p>
<p dir="auto">QDoubleSpinBox {font-size: 20px; text-align: right}</p>
<p dir="auto">QPushButton{text-align: right}</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/9366cda0-3b3b-41f6-8140-ee8b152b9ab7.png" alt="0970bd91-7a0c-4a8e-b29a-48a878de3e37-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">text-align: right has no effect in the spin box</p>
<p dir="auto">How can I change the alignment in the spin box?</p>
]]></description><link>https://forum.qt.io/topic/129939/customize-qdoublespinbox-text-align-with-css</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 19:52:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/129939.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Sep 2021 09:36:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Customize QDoubleSpinBox text align with CSS on Wed, 01 Sep 2021 09:59:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bert59">@<bdi>Bert59</bdi></a><br />
A <code>QSpinBox</code> has an internal <code>QLineEdit</code> child for the number text.  I won't lie to you, I have had trouble accessing that fully, and reported a bug, but it never got addressed.  But I did successfully change the text alignment (mine was from code, not stylesheet, for this).  That is what you will need to set the <code>text-align</code> on.  Try it from stylesheet rule (<code>QDoubleSpinBox.QLineEdit</code> or whatever the docs say the syntax is a for a child, I can't remember?), though that may be what I found did not work right.  Or to verify my claim set the stylesheet directly from code on <code>spinBox-&gt;lineEdit()</code> to check it works.  Note that method is <code>protected</code>, to access you either need to sub-class or use <code>spinBox-&gt;findChild&lt;QLineEdit *&gt;()</code>.</p>
]]></description><link>https://forum.qt.io/post/678721</link><guid isPermaLink="true">https://forum.qt.io/post/678721</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 01 Sep 2021 09:59:02 GMT</pubDate></item></channel></rss>