VirtualBox

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


Ignore:
Timestamp:
Mar 1, 2022 11:29:17 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: qt6: Help stuff. bugref:9898

  • QHelpEngine::linksForIdentifier -> QHelpEngine::documentsForIdentifier and returns a list of QHelpLink (title + url) instead of a QMap<title,url>.
  • QString version of QTextBrowser::highlighted was removed, must use QUrl variant instead.
  • QTextBrowser::setSource is not longer overridable, in 6 doSetSource should be overridden instead.
Location:
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
Files:
4 edited

Legend:

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

    r93990 r94032  
    2121#include <QtGlobal>
    2222#ifdef VBOX_WITH_QHELP_VIEWER
    23  #include <QtHelp/QHelpEngine>
    24  #include <QtHelp/QHelpContentWidget>
    25  #include <QtHelp/QHelpIndexWidget>
    26  #include <QtHelp/QHelpSearchEngine>
    27  #include <QtHelp/QHelpSearchQueryWidget>
    28  #include <QtHelp/QHelpSearchResultWidget>
     23# include <QtHelp/QHelpEngine>
     24# include <QtHelp/QHelpContentWidget>
     25# include <QtHelp/QHelpIndexWidget>
     26# include <QtHelp/QHelpSearchEngine>
     27# include <QtHelp/QHelpSearchQueryWidget>
     28# include <QtHelp/QHelpSearchResultWidget>
     29# if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
     30#  include <QtHelp/QHelpLink>
     31# endif
    2932#endif
    3033#include <QLabel>
     
    7174static const int iBookmarkUrlDataType = 6;
    7275
     76
    7377/*********************************************************************************************************************************
    74 *   UIZoomMenuAction definition.                                                                                    *
     78*   UIZoomMenuAction definition.                                                                                                 *
    7579*********************************************************************************************************************************/
    7680class UIZoomMenuAction : public QIWithRetranslateUI<QWidgetAction>
     
    187191    void sigOpenLinkInNewTab(const QUrl &url, bool fBackground);
    188192    void sigAddBookmark(const QUrl &url, const QString &strTitle);
     193#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     194    void sigLinkHighlighted(const QUrl &url);
     195#else
    189196    void sigLinkHighlighted(const QString &strLink);
     197#endif
    190198    void sigZoomPercentageChanged(int iPercentage);
    191199    void sigFindInPageWidgetVisibilityChanged(bool fVisible);
     
    267275    /** list.first is tab title and list.second is tab's index. */
    268276    void sigTabsListChanged(const QStringList &titleList);
     277#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     278    void sigLinkHighlighted(const QUrl &url);
     279#else
    269280    void sigLinkHighlighted(const QString &strLink);
     281#endif
    270282    void sigZoomPercentageChanged(int iPercentage);
    271283    void sigCopyAvailableChanged(bool fAvailable);
     
    704716    connect(m_pContentViewer, &UIHelpViewer::sigAddBookmark,
    705717            this, &UIHelpBrowserTab::sltAddBookmarkAction);
     718#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     719    connect(m_pContentViewer, static_cast<void(UIHelpViewer::*)(const QUrl&)>(&UIHelpViewer::highlighted),
     720            this, &UIHelpBrowserTab::sigLinkHighlighted);
     721#else
    706722    connect(m_pContentViewer, static_cast<void(UIHelpViewer::*)(const QString&)>(&UIHelpViewer::highlighted),
    707723            this, &UIHelpBrowserTab::sigLinkHighlighted);
     724#endif
    708725    connect(m_pContentViewer, &UIHelpViewer::sigZoomPercentageChanged,
    709726            this, &UIHelpBrowserTab::sigZoomPercentageChanged);
     
    18651882void UIHelpBrowserWidget::findAndShowUrlForKeyword(const QString &strKeyword)
    18661883{
     1884#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
     1885    QList<QHelpLink> links = m_pHelpEngine->documentsForIdentifier(strKeyword);
     1886    if (!links.isEmpty())
     1887    {
     1888        /* We have to a have a single url per keyword in this case: */
     1889        m_pTabManager->setSource(links.first().url, true /* new tab */);
     1890    }
     1891#else
    18671892    QMap<QString, QUrl> map = m_pHelpEngine->linksForIdentifier(strKeyword);
    18681893    if (!map.isEmpty())
     
    18721897        m_pTabManager->setSource(keywordUrl, true /* new tab */);
    18731898    }
     1899#endif
    18741900}
    18751901
     
    19221948}
    19231949
     1950#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     1951void UIHelpBrowserWidget::sltLinkHighlighted(const QUrl &url)
     1952{
     1953    emit sigStatusBarMessage(url.url(), 0); /** @todo qt6: ??? */
     1954}
     1955#else
    19241956void UIHelpBrowserWidget::sltLinkHighlighted(const QString &strLink)
    19251957{
    19261958    emit sigStatusBarMessage(strLink, 0);
    19271959}
     1960#endif
    19281961
    19291962void UIHelpBrowserWidget::sltMouseOverImage(const QString &strImageName)
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r93990 r94032  
    110110    void sltFindPreviousInPage();
    111111    void sltHistoryChanged(bool fBackwardAvailable, bool fForwardAvailable);
     112#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     113    void sltLinkHighlighted(const QUrl &url);
     114#else
    112115    void sltLinkHighlighted(const QString &strLink);
     116#endif
    113117    void sltMouseOverImage(const QString &strImageName);
    114118
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r94008 r94032  
    412412}
    413413
     414#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     415void UIHelpViewer::doSetSource(const QUrl &url, QTextDocument::ResourceType type)
     416#else
    414417void UIHelpViewer::setSource(const QUrl &url)
     418#endif
    415419{
    416420    clearOverlay();
     421#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     422    QTextBrowser::doSetSource(url, type);
     423#else
    417424    QTextBrowser::setSource(url);
     425#endif
    418426    QTextDocument *pDocument = document();
    419427    if (!pDocument || pDocument->isEmpty())
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h

    r93990 r94032  
    7171    virtual QVariant loadResource(int type, const QUrl &name) RT_OVERRIDE;
    7272    void emitHistoryChangedSignal();
     73#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) /* must override doSetSource in 6.0 */
    7374    virtual void setSource(const QUrl &url) RT_OVERRIDE;
     75#endif
    7476    void setFont(const QFont &);
    7577    bool isFindInPageWidgetVisible() const;
     
    100102    virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
    101103    virtual void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE;
     104#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     105    virtual void doSetSource(const QUrl &url, QTextDocument::ResourceType type = QTextDocument::UnknownResource) RT_OVERRIDE;
     106#endif
    102107
    103108private 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