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

Clinton Stimpson clinton at elemtech.com
Mon Jul 10 00:01:41 EDT 2006

> I am trying to put together a cone and a gui elements such a QPushButton, 
> this is the code...
> 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

QVTKWidget doesn't support child windows.

The QVTKWidget's X Window has a different Visual than other Windows in 
the Qt application, because VTK wants some OpenGL features supported.  
For a child to have a different Visual than its parent, the 
CWBorderPixel Window attribute must be specified, and Qt isn't doing 
that for the QPushButton.  QVTKWidget does that for whatever parent it 
may be in.

Possible workarounds:
a) Disable QVTKWidget::x11_setup_window to prevent it from having a 
different Visual.  There's currently no way to disable it except to 
modify the code.  It sometimes works, but depending on your X server 
settings, you could end up with a monochrome black/white graphics window.
b) Derive from QPushButton and do the X11 stuff to make it work as a child.
c) You could use a QGLWidget example with a QPushButton (which most 
likely will have the same problem), and post it to the Qt mailing list 
or ask Trolltech for support.  Also note that a QApplication constructor 
accepts a Visual, but I don't know why that doesn't work when I give it 
the Visual VTK wants to use.
d) Make the QPushButton a sibling instead of a child, and lay it out the 
way you want to get the same results.


More information about the vtkusers mailing list