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

coco beto j_asm1 at hotmail.com
Sat Jul 8 18:49:27 EDT 2006


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;
}

when i run this program only the cone appears but the button does not, and i 
get the following messages:

X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 12 (X_ConfigureWindow)
  Resource id:  0x3000009
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3000009
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 8 (X_MapWindow)
  Resource id:  0x3000009
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3000009
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 62 (X_CopyArea)
  Resource id:  0x3000009
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 62 (X_CopyArea)
  Resource id:  0x3000009
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 62 (X_CopyArea)
  Resource id:  0x3000009

can you help me please?

_________________________________________________________________
¿Cuánto vale tu auto? Tips para mantener tu carro. ¡De todo en MSN Latino 
Autos! http://latino.msn.com/autos/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx
Type: text/x-c++src
Size: 2500 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060708/5c10abd6/attachment.cxx>


More information about the vtkusers mailing list