<div dir="ltr">Hi All,<div><br></div><div>I am trying to show painting effect on QVTKwidget using QT painting mechanism.</div><div>As User press mouse button and move cursor I want to paint circular region under cursor. For this I have derived my widget class from QVTKwidget  and am overriding its paintevent method. </div><div><br></div><div>If I do same operation while overriding my class from QWidget it works fine,</div><div>But wth QVTKWidget I am not having any luck. It doesn't show painting effect.</div><div><br></div><div>Following is my source code . Could you please help me figure out problem in my source code ?<br></div><div><br></div><div>header file</div><div>-----------------------</div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#ifndef</span><span style="color:rgb(192,192,192)"> </span>MYWIDGET_H</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,85,255)">MYWIDGET_H</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QWidget></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QVTKWidget.h></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">class</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">public</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">QVTKWidget</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,85,255)">Q_OBJECT</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">public</span><span style="color:rgb(170,170,170)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">explicit</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QWidget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>parent<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">0</span><span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">protected</span><span style="color:rgb(170,170,170)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(85,255,255)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QPaintEngine</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">paintEngine()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">const;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic">paintEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QPaintEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic">mousePressEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic">mouseReleaseEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic">mouseMoveEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(170,170,170)">*</span><span style="color:rgb(192,192,192)"> </span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>x<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>y<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,85)">std</span><span style="color:rgb(170,170,170)">::</span><span style="color:rgb(85,255,85)">vector</span><span style="color:rgb(170,170,170)"><</span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(170,170,170)">></span><span style="color:rgb(192,192,192)"> </span>vec<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">bool</span><span style="color:rgb(192,192,192)"> </span>m_pressed<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">signals</span><span style="color:rgb(170,170,170)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">public</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">slots</span><span style="color:rgb(170,170,170)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">};</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#endif</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">MYWIDGET_H</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div>Source file</div><div>------------------------</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">"mywidget.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QPainter></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QPen></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QPolygon></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QMouseEvent></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><QLabel></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,85,255)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)"><qdebug.h></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">::</span>MyWidget<span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QWidget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>parent<span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">QVTKWidget</span><span style="color:rgb(170,170,170)">(</span>parent<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">x<span style="color:rgb(170,170,170)">=</span><span style="color:rgb(255,85,255)">100</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">y<span style="color:rgb(170,170,170)">=</span><span style="color:rgb(255,85,255)">100</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">m_pressed<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">false</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,255)">//QPaintEngine</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">MyWidget::paintEngine()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">const</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,255)">//{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,255)">//</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(85,255,255)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QVTKWidget::paintEngine();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(85,255,255)">//}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">paintEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QPaintEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,255)">//create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QPainter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">and</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">pass</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">pointer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">device.</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,255)">//A</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">paint</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">device</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">can</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">be</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QWidget,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QPixmap</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">or</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">QImage</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,85)">QPainter</span><span style="color:rgb(192,192,192)"> </span>painter<span style="color:rgb(170,170,170)">(</span><span style="color:rgb(255,255,85)">this</span><span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,255)">//create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">black</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">pen</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">that</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">has</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">solid</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">line</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,255)">//and</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">width</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">2.</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>painter<span style="color:rgb(170,170,170)">.</span>setBrush<span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QBrush</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">Qt</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic;color:rgb(85,255,85)">red</span><span style="color:rgb(170,170,170)">));</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>painter<span style="color:rgb(170,170,170)">.</span>setPen<span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QPen</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">Qt</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic;color:rgb(85,255,85)">red</span><span style="color:rgb(170,170,170)">));</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">20</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">bool</span><span style="color:rgb(192,192,192)"> </span>point_Flag<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">false</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">if</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">(!</span>point_Flag<span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(85,85,255)">qDebug</span><span style="color:rgb(170,170,170)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">"vector</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">size:"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)"><<</span>vec<span style="color:rgb(170,170,170)">.</span>size<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>xx<span style="color:rgb(170,170,170)">,</span>yy<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(255,255,85)">for</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>i<span style="color:rgb(170,170,170)">=</span><span style="color:rgb(255,85,255)">0</span><span style="color:rgb(170,170,170)">;</span>i<span style="color:rgb(170,170,170)"><</span>vec<span style="color:rgb(170,170,170)">.</span>size<span style="color:rgb(170,170,170)">();</span>i<span style="color:rgb(170,170,170)">+=</span><span style="color:rgb(255,85,255)">2</span><span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(85,255,255)">//draw</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">point</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>xx<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>vec<span style="color:rgb(170,170,170)">[</span>i<span style="color:rgb(170,170,170)">];</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>yy<span style="color:rgb(170,170,170)">=</span>vec<span style="color:rgb(170,170,170)">[</span>i<span style="color:rgb(170,170,170)">+</span><span style="color:rgb(255,85,255)">1</span><span style="color:rgb(170,170,170)">];</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>painter<span style="color:rgb(170,170,170)">.</span>drawEllipse<span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QPointF</span><span style="color:rgb(170,170,170)">(</span>xx<span style="color:rgb(170,170,170)">,</span>yy<span style="color:rgb(170,170,170)">),</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">,</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(170,170,170)">}</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">else</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>mx<span style="color:rgb(170,170,170)">,</span>my<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(255,255,85)">for</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>i<span style="color:rgb(170,170,170)">=</span><span style="color:rgb(255,85,255)">0</span><span style="color:rgb(170,170,170)">;</span>i<span style="color:rgb(170,170,170)"><</span>vec<span style="color:rgb(170,170,170)">.</span>size<span style="color:rgb(170,170,170)">();</span>i<span style="color:rgb(170,170,170)">+=</span><span style="color:rgb(255,85,255)">2</span><span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(85,255,255)">//draw</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,255)">point</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>mx<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>vec<span style="color:rgb(170,170,170)">[</span>i<span style="color:rgb(170,170,170)">];</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>my<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>vec<span style="color:rgb(170,170,170)">[</span>i<span style="color:rgb(170,170,170)">+</span><span style="color:rgb(255,85,255)">1</span><span style="color:rgb(170,170,170)">];</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>x1<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>mx<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">-</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>x2<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>mx<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">+</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>y1<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>my<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">-</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>y2<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>my<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">+</span><span style="color:rgb(192,192,192)"> </span>radius<span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">double</span><span style="color:rgb(192,192,192)"> </span>inc<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,85,255)">1</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(255,255,85)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>_x<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>x1<span style="color:rgb(170,170,170)">,</span><span style="color:rgb(192,192,192)"> </span>deltax<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">-</span>radius<span style="color:rgb(170,170,170)">;</span><span style="color:rgb(192,192,192)"> </span>_x<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)"><=</span><span style="color:rgb(192,192,192)"> </span>x2<span style="color:rgb(170,170,170)">;</span><span style="color:rgb(192,192,192)"> </span>_x<span style="color:rgb(170,170,170)">+=</span>inc<span style="color:rgb(170,170,170)">,</span><span style="color:rgb(192,192,192)"> </span>deltax<span style="color:rgb(170,170,170)">+=</span>inc<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span><span style="color:rgb(255,255,85)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(255,255,85)">int</span><span style="color:rgb(192,192,192)"> </span>_y<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>y1<span style="color:rgb(170,170,170)">,</span><span style="color:rgb(192,192,192)"> </span>deltay<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">-</span>radius<span style="color:rgb(170,170,170)">;</span><span style="color:rgb(192,192,192)"> </span>_y<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)"><=</span><span style="color:rgb(192,192,192)"> </span>y2<span style="color:rgb(170,170,170)">;</span><span style="color:rgb(192,192,192)"> </span>_y<span style="color:rgb(170,170,170)">+=</span>inc<span style="color:rgb(170,170,170)">,</span><span style="color:rgb(192,192,192)"> </span>deltay<span style="color:rgb(170,170,170)">+=</span>inc<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                    </span><span style="color:rgb(255,255,85)">float</span><span style="color:rgb(192,192,192)"> </span>dist<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span>sqrtf<span style="color:rgb(170,170,170)">(</span>deltax<span style="color:rgb(170,170,170)">*</span>deltax<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">+</span><span style="color:rgb(192,192,192)"> </span>deltay<span style="color:rgb(170,170,170)">*</span>deltay<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                    </span><span style="color:rgb(255,255,85)">if</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">(</span>dist<span style="color:rgb(170,170,170)"><</span>radius<span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                        </span>painter<span style="color:rgb(170,170,170)">.</span>drawPoint<span style="color:rgb(170,170,170)">(</span>_x<span style="color:rgb(170,170,170)">,</span>_y<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                    </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,85)">QVTKWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">paintEvent</span><span style="color:rgb(170,170,170)">(</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mousePressEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>x<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>x<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>y<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>y<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>m_pressed<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">true</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,85)">QVTKWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mousePressEvent</span><span style="color:rgb(170,170,170)">(</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mouseReleaseEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>x<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>x<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>y<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>y<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>vec<span style="color:rgb(170,170,170)">.</span>clear<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>update<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>m_pressed<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(255,255,85)">false</span><span style="color:rgb(170,170,170)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,85)">QVTKWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mouseReleaseEvent</span><span style="color:rgb(170,170,170)">(</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(255,255,85)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(85,255,85)">MyWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mouseMoveEvent</span><span style="color:rgb(170,170,170)">(</span><span style="color:rgb(85,255,85)">QMouseEvent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">*</span>event<span style="color:rgb(170,170,170)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(255,255,85)">if</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">(</span>m_pressed<span style="color:rgb(170,170,170)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(170,170,170)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>x<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>x<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>y<span style="color:rgb(170,170,170)">=</span>event<span style="color:rgb(170,170,170)">-></span>y<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>vec<span style="color:rgb(170,170,170)">.</span>push_back<span style="color:rgb(170,170,170)">(</span>x<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>vec<span style="color:rgb(170,170,170)">.</span>push_back<span style="color:rgb(170,170,170)">(</span>y<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>update<span style="color:rgb(170,170,170)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(85,255,85)">QVTKWidget</span><span style="color:rgb(170,170,170)">::</span><span style="font-style:italic">mouseMoveEvent</span><span style="color:rgb(170,170,170)">(</span>event<span style="color:rgb(170,170,170)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(170,170,170)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">thanks & regards,<div>Girish</div><div><br></div></div></div>
</div></div>

<br>
<font size="2">------------------------------</font><font size="2"><wbr>------------------------------</font><font size="2"><wbr>------------------------------</font><font size="2"><wbr>------------------------------</font><font size="2"><wbr>-<br><font face="Arial"><u><b>Disclaimer:</b></u> This email message including any attachments is confidential, and may be privileged and proprietary to Agiliad. If you are not the intended recipient, please notify us immediately by replying to this message and destroy all copies of this message including any attachments. You are NOT authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. Thank you.</font><br>------------------------------</font><font size="2"><wbr>------------------------------</font><font size="2"><wbr>------------------------------</font><font size="2"><wbr>------------------------------</font>