bonsoir tout le monde,
je suis entrain de créer une application servant à lire tout types de fichier 3D, j'ai une application console qui fait ça, mais je vais maintenant créer une application utilisant une interface graphique Qt.A l'aide d'un bouton, je vais ouvrir une boite de dialogue pour selectionner un fichier (.obj , .ply , .off ...).Mon probleme est que lorsque j'essaie de creer le maillage avec vtksurface, il m'affiche que le nom du fichier est de type QSTring, et l'application ne s'execute pas , voilà mon code:
mon fichier mainwindow.cpp:
Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMenuBar>
#include <QMessageBox>
#include "qfiledialog.h"
#include "vtkRenderWindow.h"
#include "vtkSurface.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#include "qstring.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QString fichier = QFileDialog::getOpenFileName(this, "Ouvrir un fichier", QString(), "objet 3D (*.off *.obj *.ply *.smf *.wmrl)");
QObject* parent = new QObject();



    QFileInfo fi(fichier);
  //   QString base = fi.baseName();  // base = "archive"

     ui->textbox->setText(fichier);

     Mesh=vtkSurface::New();
	 char *a=fichier.toStdString().c_str();
	 Mesh->CreateFromFile(a);
	 Mesh->DisplayMeshProperties();
      // a renderer and render window
     vtkRenderWindow *window=vtkRenderWindow::New();
     vtkRenderer *ren1 = vtkRenderer::New();
    window->AddRenderer(ren1);
    // an interactor
      vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
      iren->SetRenderWindow(window);
      // render an image (lights and cameras are created automatically)
       window->Render();
        // begin mouse interaction
       iren->Start();



}
mon fichier mainwindow.h:
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "vtkRenderWindow.h"
#include "vtkSurface.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    
private slots:
    void on_pushButton_clicked();

private:
    Ui::MainWindow *ui;
     vtkRenderWindow *window;
     vtkRenderer *ren1;
      vtkRenderWindowInteractor *iren;
       vtkSurface *Mesh;
};

#endif // MAINWINDOW_H
et monmain.cpp
Code:
#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    
    return a.exec();
}
J'espère bien trouver l'aide