Custom dock widget that should NOT appear initially

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!

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

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");
    QDockWidget* plannerDock = all_docks.front();

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!

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

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.

That is correct