<?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[qcustomplot: pixelsToCoords]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<pre><code>QVector&lt;double&gt; x;
for(int i = 0; i &lt; 128; i++){
     x.push_back(i);
}
double scale = 2000;
for(int i = -64; i &lt; 64; i++){
    x[i+64] = scale/128*i;
}
ui-&gt;graph-&gt;xAxis-&gt;setRange(-0.5*scale, 0.5*scale);
</code></pre>
<p dir="auto">I use mouse click event.</p>
<pre><code>double px, py;
ui-&gt;graph-&gt;graph(0)-&gt;pixelsToCoords(event-&gt;pos(), px, py);
</code></pre>
<p dir="auto">But I recieve 'px' in scaled values.<br />
How to convert it to QVector data index? In my case value should be between 0 and 127.</p>
]]></description><link>https://forum.qt.io/topic/127908/qcustomplot-pixelstocoords</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 02:48:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127908.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Jun 2021 17:54:53 GMT</pubDate><ttl>60</ttl></channel></rss>