<?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[Problem with global stylesheet]]></title><description><![CDATA[<p dir="auto">I'm trying to set a global stylesheet for all my buttons.<br />
Doing it for a specific button like the following, works:</p>
<pre><code>button-&gt;setStyleSheet(QString("QPushButton:focus {") +
                              "outline: 0;" +
                              "background-color: #" + BUTTON_HIGHLIGHT_BG_COLOR  + "; " +
                              "color: #"            + BUTTON_HIGHLIGHT_TXT_COLOR + "; " +
                              "}");
</code></pre>
<p dir="auto">But if I make it global, in the main.cpp, like this:</p>
<pre><code>qApp-&gt;setStyleSheet(QString("QPushButton:focus {") +
                                  "outline: 0;" +
                                  "background-color: #" + BUTTON_HIGHLIGHT_BG_COLOR + "; " +
                                  "color: #"            + BUTTON_HIGHLIGHT_TXT_COLOR + "; " +
                                  "}");
</code></pre>
<p dir="auto"><strong>[the following sentence was edited]</strong><br />
the focused buttons get the correct font color, but always with no background (transparent?), no matter the parameter I set for the background.</p>
<p dir="auto">How can I fix this?<br />
Thanks</p>
]]></description><link>https://forum.qt.io/topic/63344/problem-with-global-stylesheet</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Apr 2026 23:33:52 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/63344.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Jan 2016 09:55:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with global stylesheet on Wed, 27 Jan 2016 13:12:31 GMT]]></title><description><![CDATA[<p dir="auto">Answer here:<br />
<a href="http://stackoverflow.com/questions/35018958/global-stylesheet-isnt-fully-working" target="_blank" rel="noopener noreferrer nofollow ugc">http://stackoverflow.com/questions/35018958/global-stylesheet-isnt-fully-working</a></p>
<p dir="auto">(in short:  I had a <code>stackedWidget-&gt;setStyleSheet("background-color: white;")</code> on the loading screen. It needed to be removed or changed to: <code>stackedWidget-&gt;setStyleSheet("QStackedWidget { background-color: white; }");</code>)</p>
]]></description><link>https://forum.qt.io/post/309880</link><guid isPermaLink="true">https://forum.qt.io/post/309880</guid><dc:creator><![CDATA[AlaaM]]></dc:creator><pubDate>Wed, 27 Jan 2016 13:12:31 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with global stylesheet on Tue, 26 Jan 2016 14:40:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alaam">@<bdi>AlaaM</bdi></a><br />
i know, but i was thinking of some issue in style inheritance maybe.</p>
]]></description><link>https://forum.qt.io/post/309658</link><guid isPermaLink="true">https://forum.qt.io/post/309658</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 26 Jan 2016 14:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with global stylesheet on Tue, 26 Jan 2016 12:41:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a><br />
Please see my edit.<br />
The font color works. It's only the highlighted background that doesn't.<br />
I do this in my main window.<br />
Qt version 5.5.1</p>
]]></description><link>https://forum.qt.io/post/309631</link><guid isPermaLink="true">https://forum.qt.io/post/309631</guid><dc:creator><![CDATA[AlaaM]]></dc:creator><pubDate>Tue, 26 Jan 2016 12:41:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with global stylesheet on Tue, 26 Jan 2016 11:57:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alaam">@<bdi>AlaaM</bdi></a><br />
if possible try to set the stylesheet on your very toplevel window (mainwindow?)<br />
Also what Qt version are you using?</p>
]]></description><link>https://forum.qt.io/post/309625</link><guid isPermaLink="true">https://forum.qt.io/post/309625</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Tue, 26 Jan 2016 11:57:43 GMT</pubDate></item></channel></rss>