Skip to content

QVTKWidget vs QVTKWidget2 vs QVTKGraphicsItem.

mathildemerle edited this page Dec 13, 2019 · 6 revisions

For all of these it is impossible to draw Widget at the top of it using OSX (cocoa).

QVTKWidget

Should Works on all platform, inherits from QWidget. QPixmap QPixmap::grabWidget() seems not to work with OSX if the widget is not visible.

QVTKWidget2

QPixmap QPixmap::grabWidget() is not possible because it inherits from QGLWidget, you can use QImage QGLWidget::grabFrameBuffer() instead. This complicated the QImage medWorkspaceArea::grabScreenshot() method. Also it doesn't work with OSX the resulting QImage is randomly filled.

QVTKGraphicsItem

Allow to draw on the top of the view thanks to the QtGraphics framework. The widget returned by the view has to be a QGraphicsView. works well with some work (sync of the size of the item and the view, binds between Qt and VTK doubleClick event missing) under Linux and OSX, https://github.com/rdebroiz/medInria-public/tree/ContainerAndViewRefactoring-graphicsItem-windows but not with windows, where performances are not acceptable.

QPixmap QPixmap::grabWidget() is still not possible but we can use the QImage QGLFrmaeBufferObject::toImage() to get around (QVTKGraphicsItem, has a QGLFrmaeBufferObject as protected member).