Skip to content

Adding widgets creates new areas #728

@dail8859

Description

@dail8859

During application start before any Window is show I add several widgets like this:

    auto currentArea = dockManager->focusedDockWidget() ? dockManager->focusedDockWidget()->dockAreaWidget() : Q_NULLPTR;
    dockManager->addDockWidget(ads::CenterDockWidgetArea, myNewDockWidget, currentArea);

And it shows up in a single dock area:

Image

I updated to the latest master (df1fa27) and I now get this behavior. Each new widget shows up in a new area because currentArea is null.

Image

I traced it down to e836b15 specifically the part the adds this extra condition && (d->focusController()->focusedDockArea() == this->dockAreaWidget())

If I take that back out then the startup works as expected. I haven't looked at the original issue the commit was fixing but not sure if this needs an additional check or something.

My assumption is since d->focusController()->setDockWidgetTabFocused(this); is not getting called, nothing gets focus especially before any window is shown, thus causing my code to add it to a "null" area.

If you have suggestions, I can try out any ideas since I can reproduce it so easily.

 

Thank you for all your effort with this library. As an open-source maintainer myself I understand the time and effort it takes.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions