[vtkusers] QVTKWidget trying to put a cone and a qpushbutton, together

coco beto j_asm1 at hotmail.com
Wed Jul 12 16:31:32 EDT 2006


thanks, it works!
thanks a lot!
But, how did you realize that?



>From: Clinton Stimpson <clinton at elemtech.com>
>To: vtkusers at vtk.org,  j_asm1 at hotmail.com
>Subject: Re: [vtkusers] QVTKWidget trying to put a cone and a qpushbutton, 
>together
>Date: Tue, 11 Jul 2006 23:07:32 -0600
>
>
>I took another quick look at this...  it can be solved by doing
>
>vtkRenderWindow *renWin = vtkRenderWindow::New();
>widget.SetRenderWindow( renWin );
>
>before you call
>
>QPushButton *button = new QPushButton( "hola", &widget );
>
>Instead of after.
>
>Clint
>
>
>>I am trying to put together a cone and a gui elements such a QPushButton, 
>>this is the code...
>>
>>#include<QApplication>
>>#include<QPushButton>
>>
>>#include"vtkConeSource.h"
>>#include"vtkPolyDataMapper.h"
>>#include"vtkActor.h"
>>#include"vtkRenderer.h"
>>#include"vtkRenderWindow.h"
>>
>>#include "QVTKWidget.h"
>>
>>int main(int argc, char** argv)
>>{
>>   QApplication app(argc, argv);
>>
>>   QVTKWidget widget;
>>   widget.resize(256,256);
>>
>>#if QT_VERSION < 0x040000
>>   app.setMainWidget(&widget);
>>#endif
>>
>>QPushButton *button = new QPushButton( "hola", &widget );
>>
>>
>>vtkConeSource *cone = vtkConeSource::New();
>>cone->SetHeight( 3.0 );
>>cone->SetRadius( 1.0 );
>>cone->SetResolution( 20 );
>>
>>vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>>coneMapper->SetInputConnection( cone->GetOutputPort() );
>>
>>vtkActor *coneActor = vtkActor::New();
>>coneActor->SetMapper( coneMapper );
>>
>>vtkRenderer *ren = vtkRenderer::New();
>>ren->AddActor( coneActor );
>>ren->SetBackground( 0.1, 0.2, 0.4 );
>>
>>vtkRenderWindow *renWin = vtkRenderWindow::New();
>>renWin->AddRenderer( ren );
>>
>>   widget.SetRenderWindow( renWin );
>>
>>   widget.show();
>>
>>   app.exec();
>>
>>   cone->Delete();
>>   coneMapper->Delete();
>>   coneActor->Delete();
>>   ren->Delete();
>>   renWin->Delete();
>>
>>   return 0;
>>}
>>
>

_________________________________________________________________
Visita MSN Latino Entretenimiento: ¡música, cine, chismes, TV y más...! 
http://latino.msn.com/entretenimiento/




More information about the vtkusers mailing list