pqParaViewBehaviors affects layout effects

Hi, I’m having a problem with layouts! After calling ParaView’s pqParaViewBehaviors in my Qt application, the effect of my previous layout is completely affected. After several attempts, I realized that when adding the code “new pqParaViewBehaviors(this, this);”, it affects the original layout of the QDockWidget in QMainWindow. I’m confused about this, how to solve it please? Thank you very much!

My Paraview version is 5.13.1, Qt version is 6.6.3, and my platform is windows 11.

Previous Layout:

Add Code:

Later Layout:

Please share actual code.

You can find examples using pqParaViewBehaviors in Examples/CustomApplications

Thank you for your response! The above example is actually modified from “Examples/CustomApplications/Demo2”. I have attached the source code here.

Demo2.rar (3.6 KB)

If you comment out line 29 of myMainWindow.cxx “new pqParaViewBehaviors(this, this);”, you can see the correct layout. If you don’t comment it out, you can see the affected layout.

I seem to have solved the problem, but I’m not sure if this is the right way to do it? After I added this line of code “pqParaViewBehaviors::setEnablePersistentMainWindowStateBehavior(false);”, the layout effect disappeared and became normal.

What is the exact usage of “pqParaViewBehaviors::setEnablePersistentMainWindowStateBehavior”? Thank you very much!

It saves the state of the main window in a settings file so that if the user modifies it during usage, the next time paraview opens it stays like it was before closing.

I understand, thank you very much!

1 Like