VirtualBox

Changeset 86620 in vbox for trunk


Ignore:
Timestamp:
Oct 19, 2020 7:26:43 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Connecting content widget item click and link activation to the help viewer's setSource

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

Legend:

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

    r86603 r86620  
    160160#ifdef RT_OS_LINUX
    161161    m_pHelpEngine = new QHelpEngine(m_strHelpFilePath, this);
    162     connect(m_pHelpEngine, &QHelpEngine::setupFinished,
    163             this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
    164162
    165163    m_pTabWidget = new QITabWidget;
    166164    AssertReturnVoid(m_pTabWidget);
     165    AssertReturnVoid(m_pHelpEngine->contentWidget() && m_pHelpEngine->indexWidget());
    167166    m_pSplitter->addWidget(m_pTabWidget);
    168167    m_pTabWidget->addTab(m_pHelpEngine->contentWidget(), tr("Contents"));
     
    177176    m_pSplitter->setChildrenCollapsible(false);
    178177
     178    connect(m_pHelpEngine, &QHelpEngine::setupFinished,
     179            this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
     180
     181    connect(m_pHelpEngine->contentWidget(), &QHelpContentWidget::linkActivated,
     182            m_pTextBrowser, &UIHelpBrowserViewer::setSource);
     183    connect(m_pHelpEngine->contentWidget(), &QHelpContentWidget::clicked,
     184            this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked);
     185
     186
     187    connect(m_pHelpEngine->indexWidget(), &QHelpIndexWidget::linkActivated,
     188            m_pTextBrowser, &UIHelpBrowserViewer::setSource);
     189
    179190    if (QFile(m_strHelpFilePath).exists() && m_pHelpEngine)
    180191        m_pHelpEngine->setupData();
    181 
    182192#endif
    183193}
     
    270280}
    271281
     282void UIHelpBrowserWidget::sltHandleContentWidgetItemClicked(const QModelIndex &index)
     283{
     284#ifdef RT_OS_LINUX
     285    AssertReturnVoid(m_pTextBrowser && m_pHelpEngine && m_pHelpEngine->contentWidget());
     286    QHelpContentModel *pContentModel =
     287        qobject_cast<QHelpContentModel*>(m_pHelpEngine->contentWidget()->model());
     288    if (!pContentModel)
     289        return;
     290    QHelpContentItem *pItem = pContentModel->contentItemAt(index);
     291    if (!pItem)
     292        return;
     293    const QUrl &url = pItem->url();
     294    m_pTextBrowser->setSource(url);
     295#endif
     296}
     297
     298
    272299#include "UIHelpBrowserWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86603 r86620  
    8585
    8686    void sltHandleHelpEngineSetupFinished();
     87    void sltHandleContentWidgetItemClicked(const QModelIndex &index);
    8788
    8889private:
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