[vtkusers] QWidget:Must construct a QApplication before a QPaintDevice

Dženan Zukić dzenanz at gmail.com
Mon Aug 15 03:16:55 EDT 2011


Does this help:

http://dzenanz.wordpress.com/2011/04/05/qwidget-must-construct-a-qapplication-before-a-qpaintdevice/

On Mon, Aug 15, 2011 at 09:09, Leonid Dulman <leonid_dulman at yahoo.co.uk>wrote:

> Hi to All
> In next Example
> #include "qmainwindow.h"
>  #include "qapplication.h"
>
>  #include <QVTKWidget.h>
>  #include <QVTKApplication.h>
>
>  #include <vtkRenderWindow.h>
>  #include <vtkRenderer.h>
>  #include <vtkTextSource.h>
>  #include <vtkVectorText.h>
>  #include <vtkPolyDataMapper.h>
>  #include <vtkActor.h>
>
>  int main( int argc, char **argv )
>  {
>  QVTKApplication app(argc,argv);
>  QMainWindow *mainWindow = new QMainWindow;
>   mainWindow->setFixedSize(640,360);
>
>  QVTKWidget *widget = new QVTKWidget;
>   mainWindow->setCentralWidget(widget);
>
>  vtkTextSource *text = vtkTextSource::New();
>   text->SetText("Hello World!");
>   text->BackingOff();
>  vtkVectorText *vectorText = vtkVectorText::New();
>   vectorText->SetText("QVTKWidget");
>  vtkPolyDataMapper *textMapper = vtkPolyDataMapper::New();
>   textMapper->SetInput(text->GetOutput());
>  vtkPolyDataMapper *vectorTextMapper = vtkPolyDataMapper::New();
>   vectorTextMapper->SetInput(vectorText->GetOutput());
>  vtkActor *textActor = vtkActor::New();
>   textActor->SetMapper(textMapper);
>  vtkActor *vectorTextActor = vtkActor::New();
>   vectorTextActor->SetMapper(vectorTextMapper);
>  vtkRenderer *renderer = vtkRenderer::New();
>   renderer->SetBackground(0.4,0.6,0.8);
>   renderer->AddActor(textActor);
>   renderer->AddActor(vectorTextActor);
>  vtkRenderWindow *renderWindow = vtkRenderWindow::New();
>   renderWindow->AddRenderer(renderer);
>   renderWindow->SetStereoTypeToDresden();
>
>  widget->SetRenderWindow(renderWindow);
>  mainWindow->show();
>  app.aboutQt();
>     return app.exec();
>  }
>
> 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
>
> My installation is
> Qt 4.7.3
> VTK 5.9.0 (from git)
> Thank you. Leonid
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110815/8cad253f/attachment.htm>


More information about the vtkusers mailing list