| 573 | } |
| 574 | |
| 575 | void DockManager::openLayoutSwitcherContextMenu(const QPoint& pos, QTabBar* layout_switcher) |
| 576 | { |
| 577 | DockLayout::Index layout_index = static_cast<DockLayout::Index>(layout_switcher->tabAt(pos)); |
| 578 | if (layout_index >= m_layouts.size()) |
| 579 | return; |
| 580 | |
| 581 | DockLayout& layout = m_layouts[layout_index]; |
| 582 | |
| 583 | QMenu* menu = new QMenu(layout_switcher); |
| 584 | menu->setAttribute(Qt::WA_DeleteOnClose); |
| 585 | |
| 586 | QAction* edit_action = menu->addAction(tr("Edit Layout")); |
| 587 | connect(edit_action, &QAction::triggered, [this, layout_index]() { |
| 588 | editLayoutClicked(layout_index); |
| 589 | }); |
| 590 | |
| 591 | QAction* reset_action = menu->addAction(tr("Reset Layout")); |
| 592 | reset_action->setEnabled(layout.canReset()); |
| 593 | reset_action->connect(reset_action, &QAction::triggered, [this, layout_index]() { |
| 594 | resetLayoutClicked(layout_index); |
| 595 | }); |
| 596 | |
| 597 | QAction* delete_action = menu->addAction(tr("Delete Layout")); |
| 598 | connect(delete_action, &QAction::triggered, [this, layout_index]() { |
| 599 | deleteLayoutClicked(layout_index); |
| 600 | }); |
| 601 | |
| 602 | menu->popup(layout_switcher->mapToGlobal(pos)); |
| 603 | } |
| 604 | |
| 605 | void DockManager::editLayoutClicked(DockLayout::Index layout_index) |
| 606 | { |