<?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[Graphical artifacts in QPushButton]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have class of buttons that inherits QPushButton. I set style of this button by setting setStyleSeet method.<br />
I have QWidget container that is parent for my buttons and for other QWidget fullWidget. Buttons have its own position, but fullWidget is expanding to its parent. Buttons are raised over fullWidget. But when I do this (raise) the artifacts is showing. For example, buttons have rounded corners, but after raising they have grey background</p>
<p dir="auto">!<a href="http://oi61.tinypic.com/1p9ulz.jpg()" target="_blank" rel="noopener noreferrer nofollow ugc">http://oi61.tinypic.com/1p9ulz.jpg()</a>! - image is painted by me, it's only to show what is wrong.</p>
<p dir="auto">Any idea how to fix it?</p>
]]></description><link>https://forum.qt.io/topic/48844/graphical-artifacts-in-qpushbutton</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 19:25:13 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/48844.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Dec 2014 09:13:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Graphical artifacts in QPushButton on Mon, 08 Dec 2014 06:35:28 GMT]]></title><description><![CDATA[<p dir="auto">I have sth like this:</p>
<p dir="auto">@<br />
button-&gt;setStyleString("QPushButton{" +<br />
"padding: " + QString::number(width/3) + "px;" +<br />
"border-radius: "  + QString::number(radius/5) +  "px;" +<br />
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, " +<br />
"stop: 0 #3d94f6, stop: 1 #29569e);" +<br />
"background: transparent" +<br />
"color: white;" +<br />
"font-family: arial;" +<br />
"font-size: " + QString::number(fontSize) + "px;" +<br />
"font-weight: bold" +<br />
"}" +<br />
"QPushButton:hover{" +<br />
"border: 2px solid black;" +<br />
"border-radius: " + QString::number(radius/4) + "px;" +<br />
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, " +<br />
"stop: 0 #29569e, stop: 1 #3d94f6);" +<br />
"}"+<br />
"QPushButton:checked{" +<br />
"border: 3px solid black;" +<br />
"border-radius: " + QString::number(radius/3) + "px;" +<br />
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, " +<br />
"stop: 0 #29569e, stop: 1 #3d94f6);" +<br />
"}");</p>
<p dir="auto">@</p>
<p dir="auto">I tried that two methods:</p>
<p dir="auto">@</p>
<p dir="auto">QPushButton{<br />
"background:transparent;"<br />
...<br />
...<br />
}</p>
<p dir="auto">@</p>
<p dir="auto">and also</p>
<p dir="auto">@</p>
<p dir="auto">button-&gt;setAttribute(Qt::WA_TranslucentBackground);</p>
<p dir="auto">@</p>
<p dir="auto">but it didn't work (nothing changed)</p>
]]></description><link>https://forum.qt.io/post/253548</link><guid isPermaLink="true">https://forum.qt.io/post/253548</guid><dc:creator><![CDATA[never_ever]]></dc:creator><pubDate>Mon, 08 Dec 2014 06:35:28 GMT</pubDate></item><item><title><![CDATA[Reply to Graphical artifacts in QPushButton on Thu, 04 Dec 2014 18:24:01 GMT]]></title><description><![CDATA[<p dir="auto">I believe that is just the frame in the background of the button. Once you style the button, you have to basically redo everything that the default button style has unless you just change the palette properties.</p>
<p dir="auto">To fix the gray background, you can make the background of the button transparent (but not the frame with the rounded edges and text).</p>
<p dir="auto">So you can add to your stylesheet:</p>
<p dir="auto">@<br />
QPushButton {<br />
"background:transparent;"<br />
...<br />
...<br />
}<br />
@</p>
<p dir="auto">or you can set the background to translucent:</p>
<p dir="auto">@<br />
button-&gt;setAttribute(Qt::WA_TranslucentBackground);<br />
@</p>
]]></description><link>https://forum.qt.io/post/253193</link><guid isPermaLink="true">https://forum.qt.io/post/253193</guid><dc:creator><![CDATA[vezprog]]></dc:creator><pubDate>Thu, 04 Dec 2014 18:24:01 GMT</pubDate></item></channel></rss>