[vtkusers] VTK+QTcreator

Wagner Sales wsales at gmail.com
Thu Sep 3 15:15:46 EDT 2009


Hi Jihan,

I strongly advice you to use CMake instead qmake. May be you can solve
this problem, but may you have others in near future. CMake are
supported by QtCreator.

Regards,

Wagner Sales

2009/9/3 Jihan Zoghbi <jihanzoghbi at gmail.com>:
> Hi everybody,
>
> I'm a beginner in using VTK with QTcreator. I pick up an example from the
> Internet, which is the following.
>
> The VTK.pro
> =================================================================================
>
> TARGET = VTK_App
>
> TEMPLATE = app
>
> SOURCES += main.cpp\
>
> vtk_example.cpp
>
> HEADERS += vtk_example.h
>
> FORMS += vtk_example.ui
>
> LIBS += -L/usr/local/lib/vtk-5.4 -lvtkCommon -lvtksys -lQVTK -lvtkQtChart
> -lvtkViews -lvtkWidgets -lvtkInfovis -lvtkRendering -lvtkGraphics
> -lvtkImaging -lvtkIO -lvtkFiltering -lvtklibxml2 -lvtkDICOMParser -lvtkpng
> -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg -lvtkalglib -lvtkexpat -lvtkverdict
> -lvtkmetaio -lvtkNetCDF -lvtksqlite -lvtkexoIIc -lvtkftgl -lvtkfreetype
> -lvtkHybrid
>
> INCLUDEPATH +=/usr/local/VTK\
>
> =========================================================================================
> the main.cpp
>
>
> #include <QtGui/QApplication>
>
> #include "vtk_example.h"
>
> int main(int argc, char *argv[])
>
> {
>
> QApplication a(argc, argv);
>
> VTK_example w;
>
> w.show();
>
> return a.exec();
>
> }
>
> ====================================================================================================
> vtk_example.cpp
>
> #include <QVTKWidget.h>
>
> #include <vtkRenderer.h>
>
> #include <vtkRenderWindow.h>
>
> #include "ui_vtk_example.h"
>
> VTK_example::VTK_example(QWidget *parent)
>
> : QMainWindow(parent), ui(new Ui::VTK_example)
>
> {
>
> ui->setupUi(this);
>
> QVTKWidget* vtkWidget;
>
> vtkRenderer* ren;
>
> vtkWidget = new QVTKWidget(this,QFlag(0));
>
> ui->verticalLayout->addWidget(vtkWidget);
>
> ui->verticalLayout->update();
>
> ren = vtkRenderer::New();
>
> vtkWidget->GetRenderWindow()->AddRenderer(ren);
>
> ren->SetBackground(1.0,0,0);
>
> ren->Render();
>
> }
>
> VTK_example::~VTK_example()
>
> {
>
> //delete ui;
>
> }
>
> ===========================================================================================================
> vtk_example.h
>
> #ifndef VTK_EXAMPLE_H
>
> #define VTK_EXAMPLE_H
>
> #include <QtGui/QMainWindow>
>
> namespace Ui
>
> {
>
> class VTK_example;
>
> }
>
> class VTK_example : public QMainWindow
>
> {
>
> Q_OBJECT
>
> public:
>
> VTK_example(QWidget *parent = 0);
>
> ~VTK_example();
>
> private:
>
> Ui::VTK_example *ui;
>
> };
>
> #endif // VTK_EXAMPLE_H
>
> ==========================================
> The program compile fine, but when I execute it, the following error is
> shown:
>
> ""The program has unexpectedly finished.
>
> VTK_App exited with code 0"'
>
> Anybody has any idea about the error?
>
> Any kind of help is appreciated.
>
> --
> Jihan Zoghbi
>
>
> _______________________________________________
> 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
>
>



More information about the vtkusers mailing list