Qt Designer (5.10.1), QVTKOpenGLWidget, and size policy questions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Qt Designer (5.10.1), QVTKOpenGLWidget, and size policy questions

Elvis Chen

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?

 

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.

 

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
Reply | Threaded
Open this post in threaded view
|

Re: Qt Designer (5.10.1), QVTKOpenGLWidget, and size policy questions

Elvis Stansvik
Den tors 24 maj 2018 22:37Elvis Chen <[hidden email]> 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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicy questions

Elvis Chen

Hi,

 

Thank you very much.  The 2nd problem was indeed related to the layout. As for the 1st problem, I’ve tried to promote a widget but the “promote” button is always grayed-out in Qt Designer. I’ll have to look deeper into this issue.

 

Very much appreciated,

 

Regards,

 

 

--

Elvis C.S. Chen, PhD, LEL

 

Imaging, Robarts Research Institute

Department of Electrical and Computer Engineering

Biomedical Engineering

Medical Biophysics, Western University

London, Ontario, Canada

 

 

From: [hidden email]
Sent: May 25, 2018 2:58 AM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [vtkusers] Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicy questions

 

Den tors 24 maj 2018 22:37Elvis Chen <[hidden email]> 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

 


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicy questions

Elvis Stansvik
You have to add QVTKOpenGLWidget as a class that can be promoted to. O can make a screenshot of how you do it when I get home. You basically fill in the class name, base class and name of the header. Then you can pick it from the list of classes when promoting.

Elvis

Den fre 25 maj 2018 15:49Elvis Chen <[hidden email]> skrev:

Hi,

 

Thank you very much.  The 2nd problem was indeed related to the layout. As for the 1st problem, I’ve tried to promote a widget but the “promote” button is always grayed-out in Qt Designer. I’ll have to look deeper into this issue.

 

Very much appreciated,

 

Regards,

 

 

--

Elvis C.S. Chen, PhD, LEL

 

Imaging, Robarts Research Institute

Department of Electrical and Computer Engineering

Biomedical Engineering

Medical Biophysics, Western University

London, Ontario, Canada

 

 

From: [hidden email]
Sent: May 25, 2018 2:58 AM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [vtkusers] Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicy questions

 

Den tors 24 maj 2018 22:37Elvis Chen <[hidden email]> 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

 


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicyquestions

Elvis Chen

Thank you.  My mistake was that I was using QWidget (instead of QOpenGLWidget) as the base widget. Now it works great.

 

Really appreciated.

 

 

--

Elvis C.S. Chen, PhD, LEL

 

Imaging, Robarts Research Institute

Department of Electrical and Computer Engineering

Biomedical Engineering

Medical Biophysics, Western University

London, Ontario, Canada

 

 

From: [hidden email]
Sent: May 25, 2018 12:49 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [vtkusers] Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicyquestions

 

Here's how you do it:

Step 1: Right-click the QOpenGLWidget and pick "Promote to...":

 

Step 2: Fill in base class, class name and header name and click "Add":

Step 3: With the new entry selected in the list, click "Promote":

Step 4: Done, the class is now promoted to a QVTKOpenGLWidget:

HTH,

Elvis

 

2018-05-25 18:27 GMT+02:00 Elvis Stansvik <[hidden email]>:

You have to add QVTKOpenGLWidget as a class that can be promoted to. O can make a screenshot of how you do it when I get home. You basically fill in the class name, base class and name of the header. Then you can pick it from the list of classes when promoting.

 

Elvis

 

Den fre 25 maj 2018 15:49Elvis Chen <[hidden email]> skrev:

Hi,

 

Thank you very much.  The 2nd problem was indeed related to the layout. As for the 1st problem, I’ve tried to promote a widget but the “promote” button is always grayed-out in Qt Designer. I’ll have to look deeper into this issue.

 

Very much appreciated,

 

Regards,

 

 

--

Elvis C.S. Chen, PhD, LEL

 

Imaging, Robarts Research Institute

Department of Electrical and Computer Engineering

Biomedical Engineering

Medical Biophysics, Western University

London, Ontario, Canada

 

 

From: [hidden email]
Sent: May 25, 2018 2:58 AM
To: [hidden email]
Cc: [hidden email]
Subject: Re: [vtkusers] Qt Designer (5.10.1), QVTKOpenGLWidget, and sizepolicy questions

 

Den tors 24 maj 2018 22:37Elvis Chen <[hidden email]> 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

 

 

 


_______________________________________________
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