VirtualBox

Changeset 87217 in vbox for trunk/src


Ignore:
Timestamp:
Jan 11, 2021 5:31:52 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Adding new tab action to middle mouse click

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

Legend:

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

    r87215 r87217  
    189189    void sigSourceChanged(const QUrl &url);
    190190    void sigTitleUpdate(const QString &strTitle);
    191     void sigOpenLinkInNewTab(const QUrl &url);
     191    void sigOpenLinkInNewTab(const QUrl &url, bool fBackground);
    192192    void sigAddBookmark(const QUrl &url, const QString &strTitle);
    193193    void sigFontPointSizeChanged(int iFontPointSize);
     
    292292
    293293    void sltHandletabTitleChange(const QString &strTitle);
    294     void sltHandleOpenLinkInNewTab(const QUrl &url);
     294    void sltHandleOpenLinkInNewTab(const QUrl &url, bool fBackground);
    295295    void sltHandleTabClose(int iTabIndex);
    296296    void sltHandleContextMenuTabClose();
     
    304304    void prepare();
    305305    void clearAndDeleteTabs();
    306     void addNewTab(const QUrl &initialUrl);
     306    void addNewTab(const QUrl &initialUrl, bool fBackground);
    307307    /** Check if lists of tab url/title has changed. if so emit a signal. */
    308308    void updateTabUrlTitleList();
     
    841841}
    842842
    843 void UIHelpBrowserTabManager::addNewTab(const QUrl &initialUrl)
     843void UIHelpBrowserTabManager::addNewTab(const QUrl &initialUrl, bool fBackground)
    844844{
    845845   UIHelpBrowserTab *pTabWidget = new  UIHelpBrowserTab(m_pHelpEngine, m_homeUrl, initialUrl);
     
    860860           this, &UIHelpBrowserTabManager::sigLinkHighlighted);
    861861
    862    if (m_fSwitchToNewTab)
     862   if (!fBackground)
    863863       setCurrentIndex(index);
    864864
     
    905905    /* Start with a single tab showing the home URL: */
    906906    if (m_savedUrlList.isEmpty())
    907         addNewTab(QUrl());
     907        addNewTab(QUrl(), false);
    908908    /* Start with saved tab(s): */
    909909    else
    910910        for (int i = 0; i < m_savedUrlList.size(); ++i)
    911             addNewTab(m_savedUrlList[i]);
     911            addNewTab(m_savedUrlList[i], false);
    912912    updateTabUrlTitleList();
    913913}
     
    931931    }
    932932    else
    933         addNewTab(url);
     933        addNewTab(url, false);
    934934
    935935    updateTabUrlTitleList();
     
    10521052}
    10531053
    1054 void UIHelpBrowserTabManager::sltHandleOpenLinkInNewTab(const QUrl &url)
     1054void UIHelpBrowserTabManager::sltHandleOpenLinkInNewTab(const QUrl &url, bool fBackground)
    10551055{
    10561056    if (url.isValid())
    1057         addNewTab(url);
     1057        addNewTab(url, fBackground);
    10581058    updateTabUrlTitleList();
    10591059}
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r87211 r87217  
    520520}
    521521
     522void UIHelpViewer::mousePressEvent(QMouseEvent *pEvent)
     523{
     524    QString strAnchor = anchorAt(pEvent->pos());
     525    if (!strAnchor.isEmpty())
     526    {
     527        QString strLink = source().resolved(strAnchor).toString();
     528        emit sigOpenLinkInNewTab(strLink, true);
     529    }
     530    QIWithRetranslateUI<QTextBrowser>::mousePressEvent(pEvent);
     531}
     532
    522533void UIHelpViewer::retranslateUi()
    523534{
     
    616627    QUrl url = pSender->data().toUrl();
    617628    if (url.isValid())
    618         emit sigOpenLinkInNewTab(url);
     629        emit sigOpenLinkInNewTab(url, false);
    619630}
    620631
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h

    r87211 r87217  
    3939signals:
    4040
    41     void sigOpenLinkInNewTab(const QUrl &url);
     41    void sigOpenLinkInNewTab(const QUrl &url, bool fBackground);
    4242    void sigCloseFindInPageWidget();
    4343    void sigFontPointSizeChanged(int iFontPointSize);
     
    6666    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    6767    virtual void wheelEvent(QWheelEvent *pEvent) /* override */;
     68    virtual void mousePressEvent(QMouseEvent *pEvent) /* override */;
    6869
    6970private slots:
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