<?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[High CPU usage on QWidget&#x27;s update()]]></title><description><![CDATA[<p dir="auto">Hi, I'm trying to find out the source of a high CPU usage. I have already tried to comment out all code in the <code>paintEvent()</code>  but it didn't helped. However the CPU usage dropped rapidly when I stopped calling the <code>update()</code> function.</p>
<p dir="auto">Some facts about the device/app</p>
<ul>
<li>The app uses QWS</li>
<li>it is a full screen app</li>
</ul>
<p dir="auto">Any idea how to optimize the code? What to check?</p>
]]></description><link>https://forum.qt.io/topic/65022/high-cpu-usage-on-qwidget-s-update</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 14:09:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/65022.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 Mar 2016 14:17:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to High CPU usage on QWidget&#x27;s update() on Thu, 24 Mar 2016 15:08:06 GMT]]></title><description><![CDATA[<p dir="auto">After some testing it seems the bottle neck is the video memory throughput.</p>
]]></description><link>https://forum.qt.io/post/319306</link><guid isPermaLink="true">https://forum.qt.io/post/319306</guid><dc:creator><![CDATA[Radim]]></dc:creator><pubDate>Thu, 24 Mar 2016 15:08:06 GMT</pubDate></item><item><title><![CDATA[Reply to High CPU usage on QWidget&#x27;s update() on Tue, 15 Mar 2016 16:44:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/radim">@<bdi>Radim</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a><br />
Paint events are (ordinarily) compressed (as with keyboard events), so multiple calls to <code>update</code> generate a single paint event, provided the pending one was not consumed. Depending on the rect/region passed, the engine marks the first ancestral native widget's area as dirty and schedules a paint event. Ultimately, the dirty regions are united (geometrically) and a paint event is delivered when appropriate.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/radim">@<bdi>Radim</bdi></a>,<br />
If you're painting your widget with opaque colors and respect the <code>QRegion</code> instance passed along with the paint event, you could most probably safely set either the <code>Qt::WA_NoSystemBackground</code> attribute, or depending on the case even the <code>Qt::WA_OpaquePaintEvent</code> attribute. This'd skip the background erasing done by Qt and you should be able to squeeze a bit more out of the widget.</p>
]]></description><link>https://forum.qt.io/post/318093</link><guid isPermaLink="true">https://forum.qt.io/post/318093</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Tue, 15 Mar 2016 16:44:36 GMT</pubDate></item><item><title><![CDATA[Reply to High CPU usage on QWidget&#x27;s update() on Tue, 15 Mar 2016 12:27:28 GMT]]></title><description><![CDATA[<p dir="auto">Calls to update should schedule a paint event to happen so it should not trigger an immediate repaint. However I don't know how it can optimize this if you call update repeatedly with rectangles of different sizes.</p>
]]></description><link>https://forum.qt.io/post/318057</link><guid isPermaLink="true">https://forum.qt.io/post/318057</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 15 Mar 2016 12:27:28 GMT</pubDate></item><item><title><![CDATA[Reply to High CPU usage on QWidget&#x27;s update() on Tue, 15 Mar 2016 09:32:35 GMT]]></title><description><![CDATA[<p dir="auto">In our code we call update(QRect) multiple times to update each visualisation object.<br />
How does exactly work the update(QRect) in respect to paintEvent()? In our code we call update(QRect) multiple times. Will the paintEvent be called also multiple times or only once with the overall region including all rectangles?</p>
]]></description><link>https://forum.qt.io/post/318038</link><guid isPermaLink="true">https://forum.qt.io/post/318038</guid><dc:creator><![CDATA[Radim]]></dc:creator><pubDate>Tue, 15 Mar 2016 09:32:35 GMT</pubDate></item><item><title><![CDATA[Reply to High CPU usage on QWidget&#x27;s update() on Fri, 11 Mar 2016 22:11:22 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">How are you calling update and why ?</p>
]]></description><link>https://forum.qt.io/post/317602</link><guid isPermaLink="true">https://forum.qt.io/post/317602</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 11 Mar 2016 22:11:22 GMT</pubDate></item></channel></rss>