[IGSTK-Users] Display my first object with QT

steve.berger at istb.unibe.ch steve.berger at istb.unibe.ch
Fri Dec 13 10:51:05 EST 2013


Hi,

I'm starting to use IGSTK and try to simply display a cube in the QT's main windows. My code is very basic and compile, the window pop-up but nothing is displayed in the windows (it's only gray).
Could anyone give me a clue? I'm puzzled with that from 3 days...

Bellow are my codes, and the software versions I am using.

Thanks a lot for your support,
Cheers,
Steve



The main:
int main(int argc, char *argv[])
{
    QApplication app(argc,argv);

    MainWindow w;
    w.show();

    return app.exec();
}



The MainWindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui>
#include "igstkBoxObject.h"
#include "igstkBoxObjectRepresentation.h"
#include "igstkView3D.h"
#include "igstkQTWidget.h"

class MainWindow : public QMainWindow
{
public:
    MainWindow();

};
#endif




The MainWindow.cpp

#include "MainWindow.h"
MainWindow::MainWindow()
{
    //initialize the RealTimeClock.
    igstk::RealTimeClock::Initialize();

    // Create the box
    typedef igstk::BoxObject                ObjectType;
    typedef igstk::BoxObjectRepresentation  ObjectRepresentationType;
    ObjectType::Pointer cube = ObjectType::New();
    ObjectRepresentationType::Pointer cubeRepresentation = ObjectRepresentationType::New();
    cubeRepresentation->SetColor( 0.0, 0.0, 1.0 );
    cubeRepresentation->SetOpacity( 1.0 );
    cubeRepresentation->RequestSetBoxObject(cube);

    // View 3D
    typedef igstk::View3D View3DType;
    View3DType::Pointer view3D = View3DType::New();
    view3D->RequestResetCamera();
    view3D->RequestAddObject( cubeRepresentation );
    view3D->SetRefreshRate( 30 );
    view3D->RequestStart();

    //QT Widget
    igstk::QTWidget * myQTWidget = new igstk::QTWidget();
    myQTWidget->RequestSetView( view3D );
    setCentralWidget( myQTWidget );
}


The software versions:
QT 4.8.5
ITK 4.4.2
VTK 5.10.1
IGSTK 5.2

During the installation of VTK, I checked
VTK_USE_QT                       ON
VTK_USE_QTCHARTS        ON
VTK_USE_RENDERING     ON

During installation of IGSTK, I checked
IGSTK_USE_Qt                              ON
DESIRED_QT_VERSION               4
QT_QMAKE_EXECUTABLE         /usr/local/Trolltech/Qt-4.8.5/bin/qmake



Thanks a lot for your help!
Steve








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20131213/8ff9c239/attachment.html>


More information about the IGSTK-Users mailing list