<?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[Triggering drawForeground and drawBackground]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/40216/solved-qt-5-2-1-graphicsview-drawbackground-and-drawforeground-are-not-called-after-graphicsview-update">[SOLVED]Qt 5.2.1 GraphicsView::drawBackground and drawForeground are not called after GraphicsView::Update()</a></p>
<p dir="auto">I have been looking for a way to trigger drawForground after updating properties on mouse move, first I was using <code>update()</code> method of graphics scene, it worked prefectly, but I didn't want to trigger and entire update every time the mouse moved in my case (a selection box)</p>
<p dir="auto">anyhow, I found the solution in documentation and it worked perfectly<br />
<a href="https://doc.qt.io/qt-6/qgraphicsscene.html#invalidate" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qgraphicsscene.html#invalidate</a></p>
<p dir="auto">now I call this everytime I want to trigger only the forground layer redraw<br />
<code>self.invalidate(self.sceneRect(), QGraphicsScene.ForegroundLayer)</code></p>
<p dir="auto">best regrads,<br />
Iyad</p>
]]></description><link>https://forum.qt.io/topic/139549/triggering-drawforeground-and-drawbackground</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 17:15:20 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139549.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 24 Sep 2022 22:17:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Triggering drawForeground and drawBackground on Sun, 25 Sep 2022 12:34:00 GMT]]></title><description><![CDATA[<p dir="auto">There's a catch though, <code>graphics_scene.update()</code> makes the forground drawn even outside the boundaries of the scene, which is what I desired in my case, invalidate with scene rect doesn't, because it is limited to the rect we pass to it</p>
]]></description><link>https://forum.qt.io/post/730103</link><guid isPermaLink="true">https://forum.qt.io/post/730103</guid><dc:creator><![CDATA[Iyad Ahmed]]></dc:creator><pubDate>Sun, 25 Sep 2022 12:34:00 GMT</pubDate></item></channel></rss>