[vtkusers] QT Button on top of QVTKWidget Mac OS

Matt C mattkingc at gmail.com
Tue Oct 18 12:04:08 EDT 2016


I'm trying to display Qt buttons on top of a QVTKWidget.  This works correct
in Linux but using 
Mac OS 10.11.16, QT 4.8.7 and VTK 7.0 the buttons are invisible. (I can
click them if I know where they are).

I considered drawing the buttons right in VTK but we want to use the QT
styling and some of their more complex ui objects. Any suggestions?

The following minimal example shows the problem:
#include <QApplication.h>
#include <QVTKWidget.h>
#include <vtkSphereSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
int main( int argc, char **argv )
{
  QApplication app( argc, argv );
  QVTKWidget widget;
  widget.resize(640,384);
#if QT_VERSION < 0x040000
 app.setMainWidget(&widget);
#endif
  vtkRenderer *renderer = vtkRenderer::New();
  vtkRenderWindow *renderWindow = vtkRenderWindow::New();
  renderWindow->AddRenderer(renderer);
  widget.SetRenderWindow(renderWindow);

  QLayout* gridLayout = new QGridLayout(&widget);
  QPushButton button("Should show up");
  button.raise();
  button.raise();
  button.raise();

  gridLayout->addWidget(&button);
  widget.setLayout(gridLayout);

  widget.show();
  app.exec();
  return 0;
}



--
View this message in context: http://vtk.1045678.n5.nabble.com/QT-Button-on-top-of-QVTKWidget-Mac-OS-tp5740828.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list