From ce4d2ea02bb4a014b6c1ca4164efce5d1f7b78e0 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 17 Oct 2011 13:01:47 +0000 Subject: [PATCH] 0020512: EDF 1113 OTHER : Using webkit to display documentation Additional change: show link being hovered in the status bar --- src/Qtx/QtxWebBrowser.cxx | 16 ++++++++++++++++ src/Qtx/QtxWebBrowser.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index 60219b5fa..f88be64b5 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include /*! @@ -148,6 +149,7 @@ QMap QtxWebBrowser::myData; QtxWebBrowser::QtxWebBrowser() : QMainWindow( 0 ) { setAttribute( Qt::WA_DeleteOnClose ); + statusBar(); QWidget* frame = new QWidget( this ); @@ -180,6 +182,7 @@ QtxWebBrowser::QtxWebBrowser() : QMainWindow( 0 ) connect( myWebView, SIGNAL( titleChanged( QString ) ), SLOT( adjustTitle() ) ); connect( myWebView, SIGNAL( linkClicked( QUrl ) ), SLOT( linkClicked( QUrl ) ) ); + connect( myWebView->page(), SIGNAL( linkHovered( QString, QString, QString ) ), SLOT( linkHovered( QString, QString, QString ) ) ); setCentralWidget( frame ); setFocusProxy( myWebView ); @@ -379,6 +382,7 @@ void QtxWebBrowser::clearData() /*! \brief Called when users activated any link at the page + \param url URL being clicked \internal */ void QtxWebBrowser::linkClicked( const QUrl& url ) @@ -407,6 +411,18 @@ void QtxWebBrowser::linkClicked( const QUrl& url ) myWebView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); } +/*! + \brief Called when link is hovered + \param link link being hovered + \param title link title (if it is specified in the markup) + \param content provides text within the link element, e.g., text inside an HTML anchor tag + \internal +*/ +void QtxWebBrowser::linkHovered( const QString& link, const QString& /*title*/, const QString& /*context*/ ) +{ + statusBar()->showMessage( link ); +} + /*! \brief Update title of the window \internal diff --git a/src/Qtx/QtxWebBrowser.h b/src/Qtx/QtxWebBrowser.h index f48f7f0ca..5e34175a6 100644 --- a/src/Qtx/QtxWebBrowser.h +++ b/src/Qtx/QtxWebBrowser.h @@ -64,6 +64,7 @@ private: protected slots: virtual void linkClicked( const QUrl& ); + virtual void linkHovered( const QString&, const QString&, const QString& ); private slots: void adjustTitle(); -- 2.39.2