# Custom dock widget that should NOT appear initially

**URL:** https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142
**Category:** Development
**Created:** [August 20, 2020, 7:50am UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142 "2020-08-20T07:50:34Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [August 20, 2020, 7:50am UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/1 "2020-08-20T07:50:34Z")

</div>

I have written a plugin for a custom dock widget in my PV custom application - everything works fine “as advertised”.

Only with one thing I am struggling since a couple of hours: I want that the dock panel does NOT appear by default, but only if the user opens it through the “View” menu. Like e.g. the Python panel, the Animation panel and most others.

But with this I did not succeed so far!

Any helpful hint for that one? I would be glad!

---

<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: [August 27, 2020, 12:27pm UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/2 "2020-08-27T12:27:46Z")

</div>

You need an autostart part in your plugin for that afaik.

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [August 28, 2020, 10:30am UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/3 "2020-08-28T10:30:04Z")

</div>

Thanks for the hint!

I found that the “NonOrthogonalSource” is using an autostart interface, and I cloned the setup - successfully: I am getting calls to `startup()` and `shutdown()` properly.

Next I tried it with the following code inside the startup() function:

```
QMainWindow* mainWindow = qobject_cast<QMainWindow*>(pqCoreUtilities::mainWidget());
QList<QDockWidget*> all_docks = mainWindow->findChildren<QDockWidget*>("vtkAtgPlannerDockPanel");
if(!all_docks.empty())
{
    QDockWidget* plannerDock = all_docks.front();
    plannerDock->toggleViewAction()->setChecked(false);
}

```

or also with simply `plannerDock->hide();` in the last line. However this did not have any effect: the dock panel remains visible until I go and manually hide it in the View menu! And it turns out that at the moment when `startup()` is called, the` findChildren()` call does not find any dock widget yet. It looks like this autostart interface is for cases where something needs to be done **before** the plugin is loaded, not after.

Actually I was looking for the “magic” that so many other dock widgets seem to use that do **not** show on startup by default, but I did not find it yet!

---

<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: [August 28, 2020, 12:29pm UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/4 "2020-08-28T12:29:57Z")

</div>

This is not managed in the plugin, but in the code of the application itself (paraview or a paraview based app).

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [August 28, 2020, 2:10pm UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/5 "2020-08-28T14:10:54Z")

</div>

That’s what I first assumed, but I did not find yet where it happens!

Because it is a fact that you can open the Python docking panel, and next time you start Paraview it will again be open. So this information is in the settings file. And I also found out where: it is basically not handled by PV, but by the Qt framework that is able to save the entire setup of a main window, with dock panels and all.

The only thing that I am looking for is: Where does PV decide for the first time, if nothing is in the settings yet, what should be the default state: shown or hidden? Like for the Python panel it is hidden, for the Properties it is shown etc.

---

<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: [August 28, 2020, 2:13pm UTC](https://discourse.paraview.org/t/custom-dock-widget-that-should-not-appear-initially/5142/6 "2020-08-28T14:13:35Z")

</div>

> [@cobo](#):
>
> Because it is a fact that you can open the Python docking panel, and next time you start Paraview it will again be open. So this information is in the settings file. And I also found out where: it is basically not handled by PV, but by the Qt framework that is able to save the entire setup of a main window, with dock panels and all.

That is correct

> [@](#):
>
> The only thing that I am looking for is: Where does PV decide for the first time, if nothing is in the settings yet, what should be the default state: shown or hidden? Like for the Python panel it is hidden, for the Properties it is shown etc.

[https://gitlab.kitware.com/paraview/paraview/-/blob/master/Clients/ParaView/ParaViewMainWindow.cxx#L123](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Clients/ParaView/ParaViewMainWindow.cxx#L123)
