MCPcopy Create free account
hub / github.com/KDE/labplot / buildContextMenu

Method buildContextMenu

src/3rdparty/Qt-Advanced-Docking-System/src/DockWidgetTab.cpp:537–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537QMenu* 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//============================================================================
579bool CDockWidgetTab::isActiveTab() const
580{

Callers

nothing calls this directly

Calls 8

isTopLevelAreaMethod · 0.80
addSeparatorMethod · 0.80
openDockWidgetsCountMethod · 0.80
featuresMethod · 0.45
hasTopLevelDockWidgetMethod · 0.45
dockContainerMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected