<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Update. It seems that the first error I was getting in Windows is in fact relevant:<br>"Generic Warning: In D:\Software\VTK\source.git\Rendering\Context2D\vtkContextDevice2D.cxx, line 27<br>Error: no override found for 'vtkContextDevice2D'."<br><br>I went back to my Linux/Ubuntu machine at work, and installed the latest VTK from 'origin/nightly-master'.<br>And now I am getting the pointed error, and a core dump error in exactly the same code.<br><br>I still have the working vtk version though. I installed it a couple of months ago max. It is 6.2, but I don't know how to check minor versions, or the commit from where I installed it.<br><br>I use cmake to build, and change the vtk directory (particular_build/lib/cmake/vtk-6.2) seems clean, but I have heard that it is not recommended to have multiple vtk versions installed.<br><br>Cheers,<br>Pablo<br><br><br><div><hr id="stopSpelling">From: pablo.hernandez.cerdan@outlook.com<br>To: vtkusers@vtk.org<br>Subject: Problem with QVtkWidget not rendering vktChartXY in visual studio 2013<br>Date: Sun, 20 Jul 2014 18:12:01 +0200<br><br>
<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}
.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}
--></style>
<div dir="ltr">Hey there,<br>I am developing in Linux using gcc 4.8, but this weekend I tried to compile in Windows7 using visual studio 2013 (v120).<br>The code use QT with the QVtkWidget.<br><br>The code works properly in my Linux setup, but it does not render one of the two qtvtkwidget I have. Basically I get a white background where the widget should be, and it corrupts a little bit when resizing.<br>This widget shows 3 vtkChartXY in the same scene of a qvtkWidget.<br>I got three warning/errors but no crashing. And I can interact and render the other QtVtkWidget.<br>First:<br>"Generic Warning: In D:\Software\VTK\source.git\Rendering\Context2D\vtkContextDevice2D.cxx, line 27<br>Error: no override found for 'vtkContextDevice2D'."<br>I have no idea if this one is relevant to be honest. <br>Second:<br>"First-chance exception at 0x01E07B28 in VTKNodesEdgesEXE.exe: 0xC0000005: Access violation reading location 0x00000000."<br>Debugging this, it points to the render pipeline of the qtvtkWidget, specifically:<br>vtkContextActor.cxx<br>// Renders an actor2D's property and then it's mapper.<br>int vtkContextActor::RenderOverlay(vtkViewport* viewport)<br> // Pass the viewport details onto the context device.<br> int size[2];<br> size[0] = view_viewport_pixels.width();<br> size[1] = view_viewport_pixels.height();<br> vtkRecti viewportRect(actual_viewport_pixels.x() - view_viewport_pixels.x(),<br> actual_viewport_pixels.y() - view_viewport_pixels.y(),<br> actual_viewport_pixels.width(),<br> actual_viewport_pixels.height());<br> //(Breakpoint here:)<br>this->Context->GetDevice()->SetViewportSize(vtkVector2i(size));<br><br>And I also get:<br>"QWidget::repaint: Recursive repaint detected"<br><br>I write down my code where the errors are happening, just in case... It compiles all right in gcc, so not sure if there is something wrong with it, or I am just messing up the setup in Windows. Any hint or point to a direction to solve this is really appreciated. Or even any suggestion to improve my question being more specific is welcome.<br><br>Cheers,<br>Pablo<br><br>CODE:<br><br>MainWindow::MainWindow(QWidget *parent) :<br> QMainWindow(parent),<br> ui(new Ui::MainWindow)<br>{<br> ui->setupUi(this);<br>//First qtvtkwidget setup:<br>...<br>...<br>...<br><span style="color:#c0c0c0;"> </span><span style="color:#008000;">//</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">Multiple</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">histogram</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">in</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">same</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">qvtkWidget:</span>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoView</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span>vtkSmartPointer<span style="color:#000000;"><</span>vtkContextView<span style="color:#000000;">>::</span>New<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoView</span><span style="color:#000000;">-></span>SetInteractor<span style="color:#000000;">(</span><span style="color:#800000;">ui</span><span style="color:#000000;">-></span>widgetHisto<span style="color:#000000;">-></span>GetInteractor<span style="color:#000000;">());</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">ui</span><span style="color:#000000;">-></span>widgetHisto<span style="color:#000000;">-></span>SetRenderWindow<span style="color:#000000;">(</span><span style="color:#800000;">histoView</span><span style="color:#000000;">-></span>GetRenderWindow<span style="color:#000000;">());</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoView</span><span style="color:#000000;">-></span>GetRenderer<span style="color:#000000;">()-></span>SetBackground<span style="color:#000000;">(</span><span style="color:#000080;">0.0</span><span style="color:#000000;">,</span><span style="color:#000080;">0.0</span><span style="color:#000000;">,</span><span style="color:#000080;">0.0</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#008000;">//ui->widgetHisto->resize(550,720);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#008000;">//</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">for</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">(int</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">i=0</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">;</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">i<1</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">;</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">i++){</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"></span><span style="color:#808000;"> int</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">i</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#000080;">0</span><span style="color:#000000;">; // For simplicity.</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#808000;">auto</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histoChart</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span>vtkSmartPointer<span style="color:#000000;"><</span><span style="color:#800080;">HistogramChart</span><span style="color:#000000;">>::</span>New<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoView</span><span style="color:#000000;">-></span>GetScene<span style="color:#000000;">()-></span>AddItem<span style="color:#000000;">(</span><span style="color:#000000;">histoChart</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#008000;">//Create</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">table</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">for</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">chart.</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>vtkNew<span style="color:#000000;"><</span>vtkTable<span style="color:#000000;">></span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">table</span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>vtkNew<span style="color:#000000;"><</span>vtkIntArray<span style="color:#000000;">></span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">xArray</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">table</span><span style="color:#000000;">-></span>AddColumn<span style="color:#000000;">(</span><span style="color:#000000;">xArray</span><span style="color:#000000;">.</span>GetPointer<span style="color:#000000;">());</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>vtkNew<span style="color:#000000;"><</span>vtkIntArray<span style="color:#000000;">></span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">yArray</span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">table</span><span style="color:#000000;">-></span>AddColumn<span style="color:#000000;">(</span><span style="color:#000000;">yArray</span><span style="color:#000000;">.</span>GetPointer<span style="color:#000000;">());</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>std<span style="color:#000000;">::</span>string<span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_str</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>std<span style="color:#000000;">::</span>vector<span style="color:#000000;"><</span><span style="color:#808000;">int</span><span style="color:#000000;">></span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_data</span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> //</span><span style="color:#808000;">int</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">xRenwinSize</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#800000;">ui</span><span style="color:#000000;">-></span>widgetHisto<span style="color:#000000;">-></span>size<span style="color:#000000;">().</span>width<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#808000;">//int</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">yRenwinSize</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#800000;">ui</span><span style="color:#000000;">-></span>widgetHisto<span style="color:#000000;">-></span>size<span style="color:#000000;">().</span>height<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">xArray</span><span style="color:#000000;">-></span>SetName<span style="color:#000000;">(</span><span style="color:#008000;">"Leng-Axis"</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">yArray</span><span style="color:#000000;">-></span>SetName<span style="color:#000000;">(</span><span style="color:#008000;">"Distance</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">btwn</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">Nodes"</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_str</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">file_root</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">+</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">".hdis"</span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_data</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#800000;">graph</span><span style="color:#000000;">.</span><span style="color:#000000;">readHistogram</span><span style="color:#000000;">(</span><span style="color:#000000;">histo_str</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoData</span><span style="color:#000000;">.</span>push_back<span style="color:#000000;">(</span><span style="color:#000000;">histo_data</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histoChart</span><span style="color:#000000;">-></span>SetAutoSize<span style="color:#000000;">(</span><span style="color:#808000;">true</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#008000;">//histoChart->SetSize(vtkRectf(0.0,</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">2.0*yRenwinSize/3.0,</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">xRenwinSize,</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">yRenwinSize/3.0));</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>size_t<span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_size</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#800000;">histoData</span><span style="color:#000000;">[</span><span style="color:#000000;">i</span><span style="color:#000000;">].</span>size<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">table</span><span style="color:#000000;">-></span>SetNumberOfRows<span style="color:#000000;">(</span><span style="color:#000000;">histo_size</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#808000;">for</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">(</span>std<span style="color:#000000;">::</span>size_t<span style="color:#c0c0c0;"> </span><span style="color:#000000;">j</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#000080;">0</span><span style="color:#000000;">;</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">j</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;"><</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_size</span><span style="color:#000000;">;</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">j</span><span style="color:#000000;">++){</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">yArray</span><span style="color:#000000;">-></span>SetValue<span style="color:#000000;">(</span><span style="color:#000000;">j</span><span style="color:#000000;">,</span><span style="color:#800000;">histoData</span><span style="color:#000000;">[</span><span style="color:#000000;">i</span><span style="color:#000000;">][</span><span style="color:#000000;">j</span><span style="color:#000000;">]);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">xArray</span><span style="color:#000000;">-></span>SetValue<span style="color:#000000;">(</span><span style="color:#000000;">j</span><span style="color:#000000;">,</span><span style="color:#000000;">j</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">}</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histoChart</span><span style="color:#000000;">-></span>GetAxis<span style="color:#000000;">(</span>vtkAxis<span style="color:#000000;">::</span>BOTTOM<span style="color:#000000;">)-></span>SetRange<span style="color:#000000;">(</span><span style="color:#000080;">0</span><span style="color:#000000;">,</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histo_size</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#808000;">auto</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">plot</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">=</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">histoChart</span><span style="color:#000000;">-></span>AddPlot<span style="color:#000000;">(</span>vtkChart<span style="color:#000000;">::</span>LINE<span style="color:#000000;">)</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">plot</span><span style="color:#000000;">-></span>SetInputData<span style="color:#000000;">(</span><span style="color:#000000;">table</span><span style="color:#000000;">.</span>GetPointer<span style="color:#000000;">(),</span><span style="color:#c0c0c0;"> </span><span style="color:#000080;">0</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">,</span><span style="color:#c0c0c0;"> </span><span style="color:#000080;">1</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">ui</span><span style="color:#000000;">-></span>widgetHisto<span style="color:#000000;">-></span>GetInteractor<span style="color:#000000;">()-></span>Initialize<span style="color:#000000;">();</span></pre>}<br><br>And the main: <br><span style="color:#808000;">int</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">main</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">(</span><span style="color:#808000;">int</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">argc</span><span style="color:#000000;">,</span><span style="color:#c0c0c0;"> </span><span style="color:#808000;">char</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">**</span><span style="color:#000000;">argv</span><span style="color:#000000;">)</span>
<pre style="text-indent:0px;"><span style="color:#000000;">{</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span>QApplication<span style="color:#c0c0c0;"> </span><span style="color:#000000;">app</span><span style="color:#000000;">(</span><span style="color:#000000;">argc</span><span style="color:#000000;">,</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">argv</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">app</span><span style="color:#000000;">.</span>setApplicationName<span style="color:#000000;">(</span><span style="color:#008000;">"VTK-QT</span><span style="color:#c0c0c0;"> </span><span style="color:#008000;">Graph"</span><span style="color:#000000;">);</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800080;">MainWindow</span><span style="color:#c0c0c0;"> </span><span style="color:#000000;">mainWin</span><span style="color:#000000;">;</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">mainWin</span><span style="color:#000000;">.</span>show<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#000000;">app</span><span style="color:#000000;">.</span>exec<span style="color:#000000;">();</span></pre>
<pre style="text-indent:0px;"><br></pre>
<pre style="text-indent:0px;"><span style="color:#000000;">}</span></pre><br><br> </div></div> </div></body>
</html>