[vtkusers] Qt Designer (5.10.1), QVTKOpenGLWidget, and size policy questions

Elvis Stansvik elvis.stansvik at orexplore.com
Fri May 25 02:58:12 EDT 2018


Den tors 24 maj 2018 22:37Elvis Chen <elvis.chen at gmail.com> skrev:

> Hi all,
>
>
>
> I have 2 questions related to the integration of QVTKOpenGLWidget into Qt
> Designer and sizing policy, I seek your help.
>
>
>
> First of, I’ve installed both 32/64-bits of Qt 5.10.1 onto my Windows 10
> environment. I am using Visual Studio 2015 Enterprise edition, CMake
> 3.11.2, and vtk 9.0. Everything was compiled as 32bit application.
>
>
>
> Question #1:
>
>
>
> In order to integrate QVTKOpenGLWidget into Qt Designer, I had to copy
> QVTKWidgetPlugin.dll/pdb into a path that’s accessible to Qt Designer.
> There is no QVTKOpenGLWidgetPlugin.* as far as I can tell. In Qt Designer,
> I do have access to QVTKWidget but not QVTKOpenGLWidget.
>
>
>
> The generated .ui file hence contained QVTKWidget and I had to manually
> edit the .ui file to replace QVTKWidget with QVTKOpenGLWidget.
>
>
>
> Is this the correct way of doing things?  Is manual editing required?
>

I believe you're right in that there's no designer plugin for
QVTKOpenGLWidget.

What I usually do is insert a QOpenGLWidget in designer and the "promote"
it to a QVTKOpenGLWidget. See
http://doc.qt.io/qt-5/designer-using-custom-widgets.html#promoting-widgets

Manual editing should not be required.


>
> Question #2:
>
>
>
> I tried to follow VTK/Qt examples such as
> https://lorensen.github.io/VTKExamples/site/Cxx/Qt/ShareCameraQt/.
> Suppose I have generated a Qt app based on QMainWindow, with a QWidget as
> the centralWidget and a QVTKOpenGLWidget on top of the centralWidget (as
> seen on the example above).  This was accomplished using Qt Designer and
> the resulting .ui file resembles to the example above.
>
>
>
> While it works, I am having difficulties in setting up the size policy.
> In short, no matter what sizePolicy I set to both (or either) the QWidget
> and QVTKOpenGLWidget, their sizes are fixed. If I maximize the window, the
> QVTKOpenGLWidget does not maximize.
>
>
>
> Can anyone shed some light into this issue?  I can attach the .ui file if
> it is appropriate.
>

It sounds like you don't have a layout set on the centralWidget? Try
setting it by selecting the centralWidget and using one of the layout
buttons in the toolbars.

The containing widget must have a layout set for size policies to take
effect.

HTH
Elvis

>
>
> Any help is very much appreciated,
>
>
>
> --
>
> Elvis C.S. Chen, PhD, LEL
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180525/12a167cb/attachment.html>


More information about the vtkusers mailing list