| 421 | } |
| 422 | |
| 423 | void MainWindowPrivate::viewAdded(Sublime::AreaIndex *index, Sublime::View *view) |
| 424 | { |
| 425 | // Remove container objects in the hierarchy from the parents, |
| 426 | // because they are not needed anymore, and might lead to broken splitter hierarchy and crashes. |
| 427 | for(Sublime::AreaIndex* current = index; current; current = current->parent()) |
| 428 | { |
| 429 | QSplitter *splitter = m_indexSplitters[current]; |
| 430 | if (current->isSplit() && splitter) |
| 431 | { |
| 432 | // Also update the orientation |
| 433 | splitter->setOrientation(current->orientation()); |
| 434 | |
| 435 | for(int w = 0; w < splitter->count(); ++w) |
| 436 | { |
| 437 | auto *container = qobject_cast<Sublime::Container*>(splitter->widget(w)); |
| 438 | //we need to remove extra container before reconstruction |
| 439 | //first reparent widgets in container so that they are not deleted |
| 440 | if(container) |
| 441 | { |
| 442 | while (container->count()) |
| 443 | { |
| 444 | container->widget(0)->setParent(nullptr); |
| 445 | } |
| 446 | //and then delete the container |
| 447 | delete container; |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | ViewCreator viewCreator(this); |
| 454 | area->walkViews(viewCreator, index); |
| 455 | emit m_mainWindow->viewAdded( view ); |
| 456 | |
| 457 | setBackgroundVisible(false); |
| 458 | } |
| 459 | |
| 460 | void Sublime::MainWindowPrivate::raiseToolView(Sublime::View * view) |
| 461 | { |
nothing calls this directly
no test coverage detected