Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxWebBrowser Class Reference

The QtxWebBrowser provides a window that can display html pages from local file system. More...

#include <QtxWebBrowser.h>

Inheritance diagram for QtxWebBrowser:
Inheritance graph

Classes

class  Downloader
 A dialog box that is used to process file links. More...
 
class  Searcher
 A class is used with QtxSearchTool in order to search text within the web page. More...
 

Public Slots

virtual void load (const QString &)
 Load URL. More...
 

Public Member Functions

virtual ~QtxWebBrowser ()
 Destructor. More...
 

Static Public Member Functions

static QtxWebBrowserwebBrowser ()
 Return the only instance of the QtxWebBrowser. More...
 
static void loadUrl (const QString &, const QString &=QString())
 Load given url address and optional scroll to the specified anchor. More...
 
static void setResourceMgr (QtxResourceMgr *)
 Set resource manager. More...
 
static void shutdown ()
 Shutdown help browser. More...
 

Protected Slots

virtual void about ()
 
virtual void linkClicked (const QUrl &)
 Called when users activated any link at the page. More...
 
virtual void linkHovered (const QString &, const QString &, const QString &)
 Called when link is hovered. More...
 
virtual void linkHovered (const QString &)
 

Protected Member Functions

 QtxWebBrowser ()
 Constructor. Construct the web browser. More...
 
QtxResourceMgrresourceMgr () const
 Get resource manager. More...
 

Private Slots

void open ()
 Open file Shows "Open file" standard dialog box to allow user to choose file to open. More...
 
void adjustTitle ()
 Update title of the window. More...
 
void finished (bool)
 
void linkAction ()
 

Private Member Functions

void saveLink (const QString &)
 Save file. More...
 
void openLink (const QString &, bool=false)
 Open file. More...
 

Private Attributes

QWebEngineView * myWebView
 
QtxSearchToolmyFindPanel
 
QUrl myLastUrl
 

Static Private Attributes

static QtxWebBrowsermyBrowser = 0
 The only one instance of web browser. More...
 
static QtxResourceMgrmyResourceMgr = 0
 Resources manager. More...
 

Detailed Description

Only one instance of the QtxWebBrowser class can be created. To access the browser window, use static method QtxWebBrowser::webBrowser(), which creates an instance of the QtxWebBrowser widget (if it is not yet created) and returns a pointer to it.

You should not destroy this instance - it is done automatically after closing of the browser window. To close window programmatically use method close().

Optionally resource manager can be specified to automatically store action (open/save) and program to be used to download files in the application preferences.

The following sample demonstrates how to use web browser. In this code the browser window is created, /data/index.html file is opened and scrolled to the "anchor1" anchor on this page.

// initialize application
// - set resource manager
// ...
// show HTML page
QtxWebBrowser::loadUrl("file:///data/index.html", "anchor1");

Constructor & Destructor Documentation

QtxWebBrowser::~QtxWebBrowser ( )
virtual

References myBrowser.

Member Function Documentation

void QtxWebBrowser::about ( )
protectedvirtualslot

Shows About dialog box

Reimplemented in HelpBrowser.

void QtxWebBrowser::adjustTitle ( )
privateslot

References myWebView.

void QtxWebBrowser::finished ( bool  ok)
privateslot

References myLastUrl, and openLink().

void QtxWebBrowser::linkAction ( )
privateslot
void QtxWebBrowser::linkClicked ( const QUrl &  url)
protectedvirtualslot
Parameters
urlURL being clicked

References myWebView.

void QtxWebBrowser::linkHovered ( const QString &  link,
const QString &  ,
const QString &   
)
protectedvirtualslot
Parameters
linklink being hovered
titlelink title (if it is specified in the markup)
contentprovides text within the link element, e.g., text inside an HTML anchor tag
void QtxWebBrowser::linkHovered ( const QString &  link)
protectedvirtualslot

References myLastUrl.

void QtxWebBrowser::load ( const QString &  link)
virtualslot
Parameters
urlpath to the file to be opened in the browser

Reimplemented in HelpBrowser.

References myWebView.

void QtxWebBrowser::loadUrl ( const QString &  url,
const QString &  anchor = QString() 
)
static
Parameters
urlan url address to load
anchoran anchor to scroll page to

References Qtx::AlignCenter, Qtx::alignWidget(), load(), and webBrowser().

void QtxWebBrowser::open ( )
privateslot

References load(), and myWebView.

void QtxWebBrowser::openLink ( const QString &  fileName,
bool  force = false 
)
private
QtxResourceMgr * QtxWebBrowser::resourceMgr ( ) const
protected
Returns
resource manager

References myResourceMgr.

void QtxWebBrowser::saveLink ( const QString &  fileName)
private
Parameters
fileNamelink to the file being saved Shows "Save file" standard dialog box to allow user to choose where to save the file.
void QtxWebBrowser::setResourceMgr ( QtxResourceMgr resMgr)
static
Parameters
resMgrresource manager

References myResourceMgr.

void QtxWebBrowser::shutdown ( )
static

References myBrowser.

QtxWebBrowser * QtxWebBrowser::webBrowser ( )
static
Returns
instance of the QtxWebBrowser

References myBrowser, and QtxWebBrowser().

Member Data Documentation

QtxWebBrowser * QtxWebBrowser::myBrowser = 0
staticprivate
QtxSearchTool* QtxWebBrowser::myFindPanel
private
QUrl QtxWebBrowser::myLastUrl
private
QtxResourceMgr * QtxWebBrowser::myResourceMgr = 0
staticprivate
QWebEngineView* QtxWebBrowser::myWebView
private

The documentation for this class was generated from the following files: