-
Notifications
You must be signed in to change notification settings - Fork 681
Description
Description:
Hi, I found that after calling CDockManager::restoreState(), my pointer to the central dock area becomes invalid. Here’s a minimal example:
// Create central dock area
auto* dock = m_DockManager->createDockWidget("WelcomePage");
dock->setWidget(new QLabel("Welcome"));
m_CenterArea = m_DockManager->setCentralWidget(dock);
// Later, restore previous layout
m_DockManager->restoreState(savedState);
// After this, m_CenterArea is invalid
m_DockManager->addDockWidgetTabToArea(newDock, m_CenterArea); // may crash
// Workaround: reset central area pointer
m_CenterArea = m_DockManager->centralWidgetArea();
m_DockManager->addDockWidgetTabToArea(newDock, m_CenterArea); // works
Question:
Is it expected that restoreState() destroys and recreates the internal dock areas?
Is re-fetching the central area using centralWidgetArea() the intended way to recover it after restoring the layout?
Thanks!