VirtualBox

Changeset 86799 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 3, 2020 2:50:06 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Opening the link with right click as well

Location:
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86797 r86799  
    599599
    600600    AssertReturnVoid(m_pContentWidget && m_pIndexWidget && m_pContentModel);
    601     m_pContentWidget->installEventFilter(this);
    602601    m_pSplitter->addWidget(m_pTabWidget);
    603602
     
    616615    connect(m_pHelpEngine, &QHelpEngine::setupFinished,
    617616            this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
    618     connect(m_pContentWidget, &QHelpContentWidget::clicked,
    619             this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked);
     617    if (m_pContentWidget->selectionModel())
     618        connect(m_pContentWidget->selectionModel(), &QItemSelectionModel::selectionChanged,
     619                this, &UIHelpBrowserWidget::sltHandleContentWidgetSelectionChanged);
    620620    connect(m_pContentModel, &QHelpContentModel::contentsCreated,
    621621            this, &UIHelpBrowserWidget::sltHandleContentsCreated);
     
    771771}
    772772
    773 bool UIHelpBrowserWidget::eventFilter(QObject *pWatched, QEvent *pEvent)
    774 {
    775     if (pWatched == m_pContentWidget)
    776     {
    777         if (pEvent->type() == QEvent::MouseButtonPress ||
    778             pEvent->type() == QEvent::MouseMove ||
    779             pEvent->type() == QEvent::KeyPress ||
    780             pEvent->type() == QEvent::MouseButtonDblClick)
    781             printf("xxxxxxxxxxx %d\n", pEvent->type());
    782         else
    783             printf("%d\n", pEvent->type());
    784 
    785     }
    786     return false;
    787 }
    788 
    789773void UIHelpBrowserWidget::cleanup()
    790774{
     
    871855    const QUrl &url = pItem->url();
    872856    m_pTabManager->setCurrentSource(url);
    873 }
    874 
     857
     858    m_pContentWidget->scrollTo(index, QAbstractItemView::EnsureVisible);
     859    m_pContentWidget->expand(index);
     860
     861}
     862
     863void UIHelpBrowserWidget::sltHandleContentWidgetSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
     864{
     865    Q_UNUSED(deselected);
     866    QModelIndexList selectedItemIndices = selected.indexes();
     867    if (selectedItemIndices.isEmpty())
     868        return;
     869    sltHandleContentWidgetItemClicked(selectedItemIndices[0]);
     870}
    875871
    876872void UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange(const QUrl &source)
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86797 r86799  
    3838/* Forward declarations: */
    3939class QHBoxLayout;
     40class QItemSelection;
    4041class QVBoxLayout;
    4142class QHelpEngine;
     
    8586    void sltHandleHelpEngineSetupFinished();
    8687    void sltHandleContentWidgetItemClicked(const QModelIndex &index);
     88    void sltHandleContentWidgetSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
    8789    void sltHandleSideBarVisibility(bool togggled);
    8890    void sltHandleToolBarVisibility(bool togggled);
     
    107109    void cleanup();
    108110    QUrl findIndexHtml() const;
    109     bool eventFilter(QObject *pWatched, QEvent *pEvent);
     111    //bool eventFilter(QObject *pWatched, QEvent *pEvent);
    110112
    111113    /** @name Event handling stuff.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette