[vtkusers] QVTKOpenGLWidget and QWidgets

Sam Raby rabysam28 at gmail.com
Sun May 6 10:15:59 EDT 2018


*The solution I found was to disable multisampling on the QSurfaceFormat
before setting the default surface format, meaning to replace the
following:*

QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());

*with the following:*

QSurfaceFormat fmt = QVTKOpenGLWidget::defaultFormat();
fmt.setSamples(0);
QSurfaceFormat::setDefaultFormat(fmt);

*This was a solution to another problem that I found on this link:*
http://vtk.1045678.n5.nabble.com/Issues-using-QVTKOpenGLWidget-td5745401.html

*Would anyone explain why this fixes the issue and if there is any
consequence to this?*

*Thanks*




On Sat, May 5, 2018 at 5:20 PM, Todd <nztoddler at yahoo.com> wrote:

> Is the checkbox widget placed within the render window boundary?
>
> It sounds like the vtk render window is capturing the mouse events. I'm
> not familiar with Qt but it seems that the solution would be to grab the
> mouse event position in your vtk render widow event handler and reroute the
> event to the widget that bounds that location.
>
> On 5 May 2018 9:01 a.m., Sam Raby <rabysam28 at gmail.com> wrote:
>
> Let me rephrase the issue that I am observing. I run the following vtk
> example that uses QVTKOpenGLWidget in Qt Creator. I can successfully run
> the example. Then I added one simple QCheckBox to UI. I can compile the
> code but the checkbox does not respond to mouse clicking, meaning that If I
> click on the checkbox it does not get checked, but if I interact with the QVTKOpenGLWidget
> it causes the checkbox to be updated. Is that a bug? because what I am
> doing seems pretty basic.
>
> https://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/SideBySideRenderWindowsQt
>
> Thanks
>
>
> On Friday, May 4, 2018, Sam Raby <rabysam28 at gmail.com> wrote:
>
>
>
> I am running the following example of using QVTKOpenGLWidget to display a
> sphere.
>
> https://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/SideBySideRenderWindowsQt
>
> It works fine. Then I added one QT Checkbox. but the checkbox is not
> checkable. After debugging I realized that when I remove the following line
> of code, the checkbox starts working but QVTKOpenGLWidget does not
> display the sphere anymore. Is that something that I am missing here.
> QSlicer and other qwidgets also do not work if I keep the following like of
> code:
>
>     QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
>
>
> Thanks
>
> S
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180506/9d2c0480/attachment.html>


More information about the vtkusers mailing list