[vtkusers] Problems with QHelloWorld example in Windows 7 SP1
Leonid Dulman
leonid_dulman at yahoo.co.uk
Tue May 24 05:51:48 EDT 2011
Hi to all
I tried to excute QHelloWorld example
#include "qmainwindow.h"
#include "qapplication.h"
#include <QVTKWidget.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 )
{
QApplication app(argc,argv,true);
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();
}
In WindowsXp all works fine, but in Widows 7 SP1 ,I have got next message
QWidget : Must constract a QApplication before a QPaintDevice
QWidget : Cannot create a QWidget when no GUI is being used
I use Qt 4.7.3 and VTK 5.6.1
Thank you for any help
Leonid
More information about the vtkusers
mailing list