Changeset 86807 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 4, 2020 2:22:52 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86806 r86807 739 739 connect(m_pHelpEngine, &QHelpEngine::setupFinished, 740 740 this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished); 741 // if (m_pContentWidget->selectionModel())742 // connect(m_pContentWidget->selectionModel(), &QItemSelectionModel::selectionChanged,743 // this, &UIHelpBrowserWidget::sltHandleContentWidgetSelectionChanged);744 741 connect(m_pContentWidget, &QHelpContentWidget::clicked, 745 742 this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked); … … 747 744 this, &UIHelpBrowserWidget::sltHandleContentsCreated); 748 745 connect(m_pContentWidget, &QHelpContentWidget::customContextMenuRequested, 749 this, &UIHelpBrowserWidget::slt OpenLinksContextMenu);746 this, &UIHelpBrowserWidget::sltShowLinksContextMenu); 750 747 751 748 if (QFile(m_strHelpFilePath).exists() && m_pHelpEngine) … … 766 763 m_pSearchResultWidget = m_pSearchEngine->resultWidget(); 767 764 AssertReturnVoid(m_pSearchQueryWidget && m_pSearchResultWidget); 765 m_pSearchResultWidget->setContextMenuPolicy(Qt::CustomContextMenu); 768 766 769 767 QVBoxLayout *pSearchLayout = new QVBoxLayout(m_pSearchContainerWidget); … … 774 772 connect(m_pSearchQueryWidget, &QHelpSearchQueryWidget::search, 775 773 this, &UIHelpBrowserWidget::sltHandleSearchStart); 776 // connect(m_pSearchResultWidget, &QHelpSearchResultWidget::requestShowLink, 777 // m_pContentViewer, &UIHelpBrowserViewer::setSource); 774 connect(m_pSearchResultWidget, &QHelpSearchResultWidget::requestShowLink, 775 this, &UIHelpBrowserWidget::sltOpenLinkWithUrl); 776 connect(m_pSearchResultWidget, &QHelpContentWidget::customContextMenuRequested, 777 this, &UIHelpBrowserWidget::sltShowLinksContextMenu); 778 778 779 779 // connect(searchEngine, &QHelpSearchEngine::searchingStarted, … … 993 993 } 994 994 995 void UIHelpBrowserWidget::sltHandleContentWidgetSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)996 {997 Q_UNUSED(deselected);998 QModelIndexList selectedItemIndices = selected.indexes();999 if (selectedItemIndices.isEmpty())1000 return;1001 sltHandleContentWidgetItemClicked(selectedItemIndices[0]);1002 }1003 1004 995 void UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange(const QUrl &source) 1005 996 { … … 1052 1043 } 1053 1044 1054 void UIHelpBrowserWidget::slt OpenLinksContextMenu(const QPoint &pos)1045 void UIHelpBrowserWidget::sltShowLinksContextMenu(const QPoint &pos) 1055 1046 { 1056 1047 QWidget *pSender = qobject_cast<QWidget*>(sender()); … … 1059 1050 1060 1051 QUrl url; 1061 1062 1052 if (pSender == m_pContentWidget) 1063 1053 url = contentWidgetUrl(m_pContentWidget->currentIndex()); 1054 else if (pSender == m_pSearchResultWidget) 1055 { 1056 QTextBrowser* browser = m_pSearchResultWidget->findChild<QTextBrowser*>(); 1057 if (!browser) 1058 return; 1059 if (!browser->rect().contains(pos, true)) 1060 return; 1061 QPoint browserPos = browser->mapFromGlobal(m_pSearchResultWidget->mapToGlobal(pos)); 1062 printf("pos %d %d\n", pos.x(), pos.y()); 1063 url = browser->anchorAt(browserPos); 1064 } 1064 1065 1065 1066 if (!url.isValid()) … … 1099 1100 } 1100 1101 1102 void UIHelpBrowserWidget::sltOpenLinkWithUrl(const QUrl &url) 1103 { 1104 if (m_pTabManager && url.isValid()) 1105 m_pTabManager->setSource(url, false); 1106 } 1101 1107 #include "UIHelpBrowserWidget.moc" 1102 1108 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r86806 r86807 86 86 void sltHandleHelpEngineSetupFinished(); 87 87 void sltHandleContentWidgetItemClicked(const QModelIndex &index); 88 void sltHandleContentWidgetSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);89 88 void sltHandleSideBarVisibility(bool togggled); 90 89 void sltHandleToolBarVisibility(bool togggled); … … 95 94 void sltHandleSearchStart(); 96 95 void sltHandleHelpBrowserViewerSourceChange(const QUrl &source); 97 void sltOpenLinksContextMenu(const QPoint &pos); 96 void sltOpenLinkWithUrl(const QUrl &url); 97 void sltShowLinksContextMenu(const QPoint &pos); 98 98 void sltOpenLinkInNewTab(); 99 99 void sltOpenLink();
Note:
See TracChangeset
for help on using the changeset viewer.