# pqParaViewBehaviors affects layout effects

**URL:** https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881
**Category:** Development
**Created:** [December 19, 2024, 3:42am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881 "2024-12-19T03:42:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![flipper](https://discourse.paraview.org/user_avatar/discourse.paraview.org/flipper/32/15693_2.png) [@flipper](https://discourse.paraview.org/u/flipper)
#### Post date: [December 19, 2024, 3:42am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/1 "2024-12-19T03:42:47Z")

</div>

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:

 ![pre_layout](https://discourse.paraview.org/uploads/default/original/2X/8/83c0935f63c26596f552d719eecc475f8413bb86.png)

Add Code:

 ![code](https://discourse.paraview.org/uploads/default/original/2X/8/8e701c9159bc7b6f69cb07937704e31cf7bfc660.png)

Later Layout:

 ![after_layout](https://discourse.paraview.org/uploads/default/original/2X/b/b35bf77978c6e2e2520a476267246a96777ff3a4.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 19, 2024, 8:46am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/2 "2024-12-19T08:46:55Z")

</div>

Please share actual code.

You can find examples using pqParaViewBehaviors in Examples/CustomApplications

---

<div class="post-metadata">

### Author: ![flipper](https://discourse.paraview.org/user_avatar/discourse.paraview.org/flipper/32/15693_2.png) [@flipper](https://discourse.paraview.org/u/flipper)
#### Post date: [December 20, 2024, 3:45am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/3 "2024-12-20T03:45:55Z")

</div>

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

[Demo2.rar](https://discourse.paraview.org/uploads/short-url/r1zGmkeQWgDgXHVtEAKCdTHD9hW.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.

---

<div class="post-metadata">

### Author: ![flipper](https://discourse.paraview.org/user_avatar/discourse.paraview.org/flipper/32/15693_2.png) [@flipper](https://discourse.paraview.org/u/flipper)
#### Post date: [December 30, 2024, 3:11am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/4 "2024-12-30T03:11:15Z")

</div>

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!

 ![aa](https://discourse.paraview.org/uploads/default/original/2X/d/d7123f85e2b8a460ca54617f49177137eca4ee91.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 30, 2024, 9:17am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/5 "2024-12-30T09:17:58Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![flipper](https://discourse.paraview.org/user_avatar/discourse.paraview.org/flipper/32/15693_2.png) [@flipper](https://discourse.paraview.org/u/flipper)
#### Post date: [December 31, 2024, 2:41am UTC](https://discourse.paraview.org/t/pqparaviewbehaviors-affects-layout-effects/15881/6 "2024-12-31T02:41:34Z")

</div>

I understand, thank you very much!
