<?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[Proprietary stylesheet for a button in external stylesheet file]]></title><description><![CDATA[<p dir="auto">Hi<br />
I'm loading an external style sheet file for my form.<br />
this is code :<br />
@<br />
QPushButton{<br />
background: transparent;<br />
color: white;<br />
}</p>
<p dir="auto">QPushButton QPushButton:on{<br />
background: transparent;<br />
color: white;<br />
}<br />
@</p>
<p dir="auto">How can i set this style sheet for just one button with name  btngo ?</p>
]]></description><link>https://forum.qt.io/topic/17299/proprietary-stylesheet-for-a-button-in-external-stylesheet-file</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 04:45:19 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/17299.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Jun 2012 14:24:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 19:37:05 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="DerManu" date="1338837244"]So in this case<br />
//EDIT: Ah now I think I get it, you want to define inside the CSS file which button name to style, right? I don't know of a Qt-way to do that. Maybe you should parse the CSS file yourself and add some extended syntax which then uses the findChild function to apply it to a QWidget with the specified name.[/quote]</p>
<p dir="auto">yes right.<br />
i fixed it with parsing string.<br />
thanks a lot.</p>
]]></description><link>https://forum.qt.io/post/140830</link><guid isPermaLink="true">https://forum.qt.io/post/140830</guid><dc:creator><![CDATA[absfrm]]></dc:creator><pubDate>Mon, 04 Jun 2012 19:37:05 GMT</pubDate></item><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 19:14:04 GMT]]></title><description><![CDATA[<p dir="auto">So in this case<br />
@<br />
qApp-&gt;findChild&lt;QPushButton*&gt;("btngo")<br />
@<br />
seems to return the wrong button (or none at all). Is the button really called btngo? What's returned by ui-&gt;btngo-&gt;name()?<br />
Further, try using the findChild not on qApp but on your main window (or the window which contains the button) instead.</p>
<p dir="auto">//EDIT: Ah now I think I get it, you want to define inside the CSS file which button name to style, right? I don't know of a Qt-way to do that. Maybe you should parse the CSS file yourself and add some extended syntax which then uses the findChild function to apply it to a QWidget with the specified name.</p>
]]></description><link>https://forum.qt.io/post/140824</link><guid isPermaLink="true">https://forum.qt.io/post/140824</guid><dc:creator><![CDATA[DerManu]]></dc:creator><pubDate>Mon, 04 Jun 2012 19:14:04 GMT</pubDate></item><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 18:59:31 GMT]]></title><description><![CDATA[<p dir="auto">No,i want to define it in .qss file in external style sheet</p>
<p dir="auto">ui-&gt;btngo-&gt;setStyleSheet(); is working right</p>
]]></description><link>https://forum.qt.io/post/140825</link><guid isPermaLink="true">https://forum.qt.io/post/140825</guid><dc:creator><![CDATA[absfrm]]></dc:creator><pubDate>Mon, 04 Jun 2012 18:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 16:11:09 GMT]]></title><description><![CDATA[<p dir="auto">Is the correct pointer returned by findChild? Does the styleSheet work when using it on the variable (i.e. ui-&gt;btngo-&gt;setStyleSheet or similar?</p>
]]></description><link>https://forum.qt.io/post/140809</link><guid isPermaLink="true">https://forum.qt.io/post/140809</guid><dc:creator><![CDATA[DerManu]]></dc:creator><pubDate>Mon, 04 Jun 2012 16:11:09 GMT</pubDate></item><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 15:29:22 GMT]]></title><description><![CDATA[<p dir="auto">@<br />
qApp-&gt;findChild&lt;QPushButton*&gt;("btngo")-&gt;setStyleSheet("QPushButton{background: transparent; color: white;}QPushButton QPushButton:pressed{background: transparent;color: white;}");<br />
@<br />
no work!</p>
<p dir="auto">any way to explain it in style sheet file?</p>
]]></description><link>https://forum.qt.io/post/140804</link><guid isPermaLink="true">https://forum.qt.io/post/140804</guid><dc:creator><![CDATA[absfrm]]></dc:creator><pubDate>Mon, 04 Jun 2012 15:29:22 GMT</pubDate></item><item><title><![CDATA[Reply to Proprietary stylesheet for a button in external stylesheet file on Mon, 04 Jun 2012 15:08:48 GMT]]></title><description><![CDATA[<p dir="auto">Try<br />
@<br />
qApp-&gt;findChild&lt;QPushButton*&gt;("btngo")-&gt;setStyleSheet("...style...");<br />
@</p>
<p dir="auto">If you have multiple "btngo"-buttons that should all have that stylesheet, use findChildren and iterate over the list.</p>
]]></description><link>https://forum.qt.io/post/140798</link><guid isPermaLink="true">https://forum.qt.io/post/140798</guid><dc:creator><![CDATA[DerManu]]></dc:creator><pubDate>Mon, 04 Jun 2012 15:08:48 GMT</pubDate></item></channel></rss>