<?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[Unexpected colour when displaying a pixmap]]></title><description><![CDATA[<p dir="auto">I ran the following code in the debugger with breakpoint set on the <em>first</em> pen.setColor call.</p>
<pre><code>if (stars[i].m_bAdded)
	pen.setColor(qRgba(0, 0, 255, m_bCometMode ? 255 * 0.5 : 255));
else
	pen.setColor(qRgba(0, 190, 0, m_bCometMode ? 255 * 0.5 : 255));

painter.drawEllipse(rc);
</code></pre>
<p dir="auto">the breakpoint was never hit.</p>
<p dir="auto">Putting the breakpoint on the second pen.setColor was hit many times (for every star).</p>
<p dir="auto">So I know that the colour used to draw the ellipse should be green.</p>
<p dir="auto">The pixmap is built and then written to the screen in the paintEvent handler:</p>
<pre><code>	void EditStars::paintEvent(&lsqb;&lsqb;maybe_unused&rsqb;&rsqb; QPaintEvent* event)
	{
		QPainter painter(this);
		drawOnPixmap();
		//
		// Draw the stuff we drew onto the working pixmap onto the screen
		//
		painter.setBackgroundMode(Qt::TransparentMode);
		painter.drawPixmap(0, 0, pixmap);

		painter.end();
	}
</code></pre>
<p dir="auto">So why are all those ellipses</p>
<pre><code class="language-diff">-RED???
</code></pre>
]]></description><link>https://forum.qt.io/topic/139274/unexpected-colour-when-displaying-a-pixmap</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 04:06:35 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139274.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Sep 2022 10:34:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unexpected colour when displaying a pixmap on Tue, 13 Sep 2022 11:29:19 GMT]]></title><description><![CDATA[<p dir="auto">Aaarrrggghhh!  painter.setPen(pen) would help wouldn't it! &lt;&lt;BLUSH&gt;&gt;</p>
]]></description><link>https://forum.qt.io/post/728537</link><guid isPermaLink="true">https://forum.qt.io/post/728537</guid><dc:creator><![CDATA[Perdrix]]></dc:creator><pubDate>Tue, 13 Sep 2022 11:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to Unexpected colour when displaying a pixmap on Tue, 13 Sep 2022 10:47:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/perdrix">@<bdi>Perdrix</bdi></a> I don't see where you're using the pen actually?</p>
]]></description><link>https://forum.qt.io/post/728535</link><guid isPermaLink="true">https://forum.qt.io/post/728535</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 13 Sep 2022 10:47:57 GMT</pubDate></item></channel></rss>