| 535 | } |
| 536 | |
| 537 | QMenu* CDockWidgetTab::buildContextMenu(QMenu *Menu) |
| 538 | { |
| 539 | if (Menu == nullptr) { |
| 540 | Menu = new QMenu(this); |
| 541 | } |
| 542 | |
| 543 | const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable); |
| 544 | const bool isNotOnlyTabInContainer = !d->DockArea->dockContainer()->hasTopLevelDockWidget(); |
| 545 | const bool isTopLevelArea = d->DockArea->isTopLevelArea(); |
| 546 | const bool isDetachable = isFloatable && isNotOnlyTabInContainer; |
| 547 | QAction* Action; |
| 548 | |
| 549 | if (!isTopLevelArea) |
| 550 | { |
| 551 | Action = Menu->addAction(tr("Detach"), this, SLOT(detachDockWidget())); |
| 552 | Action->setEnabled(isDetachable); |
| 553 | if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled)) |
| 554 | { |
| 555 | Action = Menu->addAction(tr("Pin"), this, SLOT(autoHideDockWidget())); |
| 556 | auto IsPinnable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetPinnable); |
| 557 | Action->setEnabled(IsPinnable); |
| 558 | |
| 559 | auto menu = Menu->addMenu(tr("Pin To...")); |
| 560 | menu->setEnabled(IsPinnable); |
| 561 | d->createAutoHideToAction(tr("Top"), SideBarTop, menu); |
| 562 | d->createAutoHideToAction(tr("Left"), SideBarLeft, menu); |
| 563 | d->createAutoHideToAction(tr("Right"), SideBarRight, menu); |
| 564 | d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | Menu->addSeparator(); |
| 569 | Action = Menu->addAction(tr("Close"), this, SIGNAL(closeRequested())); |
| 570 | Action->setEnabled(isClosable()); |
| 571 | if (d->DockArea->openDockWidgetsCount() > 1) |
| 572 | { |
| 573 | Action = Menu->addAction(tr("Close Others"), this, SIGNAL(closeOtherTabsRequested())); |
| 574 | } |
| 575 | |
| 576 | return Menu; |
| 577 | } |
| 578 | //============================================================================ |
| 579 | bool CDockWidgetTab::isActiveTab() const |
| 580 | { |
nothing calls this directly
no test coverage detected