Changeset 86921 in vbox
- Timestamp:
- Nov 19, 2020 2:33:34 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86913 r86921 426 426 void sltHandleOpenLinkInNewTab(const QUrl &url); 427 427 void sltHandleTabClose(int iTabIndex); 428 /** Closes/deletes all tabs other than the one with tab index @iTabIndex. */ 429 void sltHandleOtherTabs(); 428 430 void sltHandleCurrentChanged(int iTabIndex); 429 431 void sltHandleFontSizeChange(int iFontPointSize); 432 void sltShowTabBarContextMenu(const QPoint &pos); 430 433 431 434 private: … … 1591 1594 } 1592 1595 1596 void UIHelpBrowserTabManager::sltHandleOtherTabs() 1597 { 1598 QAction *pAction = qobject_cast<QAction*>(sender()); 1599 if (!pAction) 1600 return; 1601 int iTabIndex = pAction->data().toInt(); 1602 if (iTabIndex < 0 || iTabIndex >= count()) 1603 return; 1604 QString strTitle = tabText(iTabIndex); 1605 QList<QWidget*> widgetList; 1606 for (int i = 0; i < count(); ++i) 1607 widgetList.append(widget(i)); 1608 clear(); 1609 for (int i = 0; i < widgetList.size(); ++i) 1610 { 1611 if (i != iTabIndex) 1612 delete widgetList[i]; 1613 } 1614 addTab(widgetList[iTabIndex], strTitle); 1615 } 1616 1593 1617 void UIHelpBrowserTabManager::sltHandleCurrentChanged(int iTabIndex) 1594 1618 { … … 1600 1624 { 1601 1625 setFontPointSize(iFontPointSize); 1626 } 1627 1628 void UIHelpBrowserTabManager::sltShowTabBarContextMenu(const QPoint &pos) 1629 { 1630 if (!tabBar()) 1631 return; 1632 QMenu menu; 1633 QAction *pCloseAll = menu.addAction(UIHelpBrowserWidget::tr("Close other tabs")); 1634 connect(pCloseAll, &QAction::triggered, this, &UIHelpBrowserTabManager::sltHandleOtherTabs); 1635 pCloseAll->setData(tabBar()->tabAt(pos)); 1636 menu.exec(tabBar()->mapToGlobal(pos)); 1602 1637 } 1603 1638 … … 1608 1643 connect(this, &UIHelpBrowserTabManager::tabCloseRequested, this, &UIHelpBrowserTabManager::sltHandleTabClose); 1609 1644 connect(this, &UIHelpBrowserTabManager::currentChanged, this, &UIHelpBrowserTabManager::sltHandleCurrentChanged); 1645 if (tabBar()) 1646 { 1647 tabBar()->setContextMenuPolicy(Qt::CustomContextMenu); 1648 connect(tabBar(), &QTabBar::customContextMenuRequested, this, &UIHelpBrowserTabManager::sltShowTabBarContextMenu); 1649 } 1610 1650 } 1611 1651 … … 2135 2175 if (!browser) 2136 2176 return; 2137 // if (!browser->rect().contains(pos, true))2138 // return;2139 2177 QPoint browserPos = browser->mapFromGlobal(m_pSearchResultWidget->mapToGlobal(pos)); 2140 2178 url = browser->anchorAt(browserPos);
Note:
See TracChangeset
for help on using the changeset viewer.