<?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[Does using QPainter to &quot;copy&quot; a canvas embedded in QWebView copy or share memory?]]></title><description><![CDATA[<p dir="auto">I have a QWebView loaded with an HTML page that has a canvas element called canvas0. (The embedded canvas occupies the entire viewport)</p>
<p dir="auto">When I do the following, is there a full copy operation happening under the hood or does this share memory?</p>
<p dir="auto">@<br />
QWebElement el = page()-&gt;mainFrame()-&gt;findFirstElement("#canvas0");</p>
<pre><code>QImage image(el.geometry().width(), el.geometry().height(), QImage::Format_ARGB32);
QPainter painter(&amp;image);
el.render(&amp;painter);
painter.end();
</code></pre>
<p dir="auto">@</p>
<p dir="auto">I'm doing that so that I can then use QImage to get the pixel value at the mouse position:</p>
<p dir="auto">@<br />
QRgb rgbVal = image.pixel(mouseEvent-&gt;x(), mouseEvent-&gt;y());<br />
@</p>
<p dir="auto">If I do that on each mousemove event, and it's copying and not sharing memory, I worry about performance..  Perhaps there is a better way for me to get the pixel value at the mouse-location from the QWebView widget itself?</p>
]]></description><link>https://forum.qt.io/topic/51789/does-using-qpainter-to-copy-a-canvas-embedded-in-qwebview-copy-or-share-memory</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 09:35:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/51789.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 Feb 2015 22:13:57 GMT</pubDate><ttl>60</ttl></channel></rss>