<font size="2"><font face="verdana,sans-serif">Does this help:</font></font><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font><div><font size="2"><font face="verdana,sans-serif"><a href="http://dzenanz.wordpress.com/2011/04/05/qwidget-must-construct-a-qapplication-before-a-qpaintdevice/">http://dzenanz.wordpress.com/2011/04/05/qwidget-must-construct-a-qapplication-before-a-qpaintdevice/</a><br>
</font></font><div><div><br><div class="gmail_quote">On Mon, Aug 15, 2011 at 09:09, Leonid Dulman <span dir="ltr"><<a href="mailto:leonid_dulman@yahoo.co.uk">leonid_dulman@yahoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi to All<br>
In next Example<br>
#include "qmainwindow.h"<br>
#include "qapplication.h"<br>
<br>
#include <QVTKWidget.h><br>
#include <QVTKApplication.h><br>
<br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkTextSource.h><br>
#include <vtkVectorText.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
<br>
int main( int argc, char **argv )<br>
{<br>
QVTKApplication app(argc,argv);<br>
QMainWindow *mainWindow = new QMainWindow;<br>
mainWindow->setFixedSize(640,360);<br>
<br>
QVTKWidget *widget = new QVTKWidget;<br>
mainWindow->setCentralWidget(widget);<br>
<br>
vtkTextSource *text = vtkTextSource::New();<br>
text->SetText("Hello World!");<br>
text->BackingOff();<br>
vtkVectorText *vectorText = vtkVectorText::New();<br>
vectorText->SetText("QVTKWidget");<br>
vtkPolyDataMapper *textMapper = vtkPolyDataMapper::New();<br>
textMapper->SetInput(text->GetOutput());<br>
vtkPolyDataMapper *vectorTextMapper = vtkPolyDataMapper::New();<br>
vectorTextMapper->SetInput(vectorText->GetOutput());<br>
vtkActor *textActor = vtkActor::New();<br>
textActor->SetMapper(textMapper);<br>
vtkActor *vectorTextActor = vtkActor::New();<br>
vectorTextActor->SetMapper(vectorTextMapper);<br>
vtkRenderer *renderer = vtkRenderer::New();<br>
renderer->SetBackground(0.4,0.6,0.8);<br>
renderer->AddActor(textActor);<br>
renderer->AddActor(vectorTextActor);<br>
vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br>
renderWindow->AddRenderer(renderer);<br>
renderWindow->SetStereoTypeToDresden();<br>
<br>
widget->SetRenderWindow(renderWindow);<br>
mainWindow->show();<br>
app.aboutQt();<br>
return app.exec();<br>
}<br>
<br>
I have got massage "QWidget:Must construct a QApplication before a QPaintDevice" only in Windows 7 SP1, in Windows XP and linux I have no any problems<br>
<br>
My installation is<br>
Qt 4.7.3<br>
VTK 5.9.0 (from git)<br>
Thank you. Leonid<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div></div></div></div>